gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 353c0c1 104/113: Imported recent work in maste


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 353c0c1 104/113: Imported recent work in master, conflict fixed
Date: Fri, 16 Apr 2021 10:34:01 -0400 (EDT)

branch: master
commit 353c0c17e4df3b23b387840063546d1cfd73c423
Merge: ac2a821 280df1e
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Imported recent work in master, conflict fixed
    
    Some conflicts came up in the new way that NoiseChisel checks
    neighbor-related options which was generalized for 3D datasets.
---
 .autom4te.cfg                                      |  12 +-
 .dir-locals.el                                     |   7 +
 .gitignore                                         |  11 +-
 .mailmap                                           |   9 +
 COPYING.FDL                                        | 419 ++++++++++++
 ChangeLog                                          |  21 +
 Makefile.am                                        |  10 +-
 NEWS                                               | 103 ++-
 README                                             |  26 +
 README-hacking                                     |  17 +-
 THANKS                                             |  17 +-
 bin/TEMPLATE/astTEMPLATE.conf                      |   2 +
 bin/arithmetic/arithmetic.c                        |  16 +-
 bin/arithmetic/astarithmetic.conf                  |   2 +
 bin/arithmetic/ui.c                                |   2 +
 bin/buildprog/astbuildprog.conf.in                 |   2 +
 bin/convertt/astconvertt.conf                      |   2 +
 bin/convertt/convertt.c                            |  19 +-
 bin/convertt/ui.c                                  |   2 +-
 bin/convolve/astconvolve.conf                      |   2 +
 bin/convolve/ui.c                                  |   4 +-
 bin/cosmiccal/astcosmiccal.conf                    |   2 +
 bin/cosmiccal/cosmiccal.c                          |   2 +-
 bin/crop/astcrop.conf                              |   2 +
 bin/crop/wcsmode.c                                 |   3 +
 bin/fits/args.h                                    |  17 +-
 bin/fits/astfits.conf                              |   2 +
 bin/fits/fits.c                                    |  16 +-
 bin/fits/keywords.c                                |  42 ++
 bin/fits/main.h                                    |   1 +
 bin/fits/ui.c                                      |  27 +-
 bin/fits/ui.h                                      |   3 +-
 bin/gnuastro.conf                                  |   2 +
 bin/match/astmatch.conf                            |   2 +
 bin/match/match.c                                  |   4 +-
 bin/mkcatalog/astmkcatalog.conf                    |   2 +
 bin/mkcatalog/ui.c                                 |   2 +-
 bin/mknoise/astmknoise.conf                        |   2 +
 bin/mkprof/astmkprof.conf                          |   2 +
 bin/mkprof/ui.c                                    |  12 +-
 bin/noisechisel/astnoisechisel.conf                |   2 +
 bin/noisechisel/ui.c                               | 105 ++-
 bin/script/Makefile.am                             |  50 ++
 bin/script/sort-by-night.in                        | 303 +++++++++
 bin/segment/astsegment.conf                        |   2 +
 bin/segment/ui.c                                   |   4 +
 bin/statistics/aststatistics.conf                  |   2 +
 bin/statistics/ui.c                                |   8 +-
 bin/table/args.h                                   |  40 ++
 bin/table/asttable.conf                            |   2 +
 bin/table/main.h                                   |  18 +-
 bin/table/table.c                                  | 235 ++++++-
 bin/table/ui.c                                     | 441 ++++++++++++-
 bin/table/ui.h                                     |  10 +-
 bin/warp/astwarp.conf                              |   2 +
 bin/warp/ui.c                                      |   3 +
 bootstrap.conf                                     |   4 +
 bootstrapped/README                                |  21 +-
 configure.ac                                       |   1 +
 doc/Makefile.am                                    |   7 +-
 doc/README                                         |  20 +
 doc/announce-acknowledge.txt                       |  18 +-
 doc/formath.texi                                   |   2 +
 doc/gnuastro-figures/README                        |  29 +
 doc/gnuastro.en.html                               |   8 +-
 doc/gnuastro.fr.html                               |   8 +-
 doc/gnuastro.texi                                  | 729 ++++++++++++++++++---
 doc/gnuastro.translist                             |  16 +
 doc/javascript.html                                |  22 +
 doc/plotsrc/README                                 |  34 +-
 doc/release-checklist.txt                          |  28 +-
 lib/arithmetic.c                                   | 326 +++++----
 lib/eps.c                                          |   8 +-
 lib/fits.c                                         | 136 +++-
 lib/gnuastro-internal/README                       |  18 +-
 lib/gnuastro-internal/options.h                    |   4 +
 lib/gnuastro.pc.in                                 |  20 +
 lib/gnuastro/README                                |  18 +-
 lib/gnuastro/arithmetic.h                          |   2 +-
 lib/gnuastro/eps.h                                 |   2 +-
 lib/gnuastro/fits.h                                |   8 +
 lib/gnuastro/pdf.h                                 |   2 +-
 lib/gnuastro/qsort.h                               |  60 +-
 lib/gnuastro/table.h                               |   5 +
 lib/label.c                                        |   4 +-
 lib/options.c                                      |  91 ++-
 lib/pdf.c                                          |   4 +-
 lib/qsort.c                                        | 158 ++++-
 lib/statistics.c                                   |   5 +-
 lib/table.c                                        |  23 +-
 lib/tile.c                                         |  37 +-
 lib/wcs.c                                          |  59 +-
 tests/Makefile.am                                  |   7 +-
 tests/arithmetic/connected-components.sh           |   1 +
 tests/arithmetic/onlynumbers.sh                    |   1 +
 tests/arithmetic/or.sh                             |   1 +
 tests/arithmetic/snimage.sh                        |   1 +
 tests/arithmetic/where.sh                          |   1 +
 tests/buildprog/simpleio.sh                        |   1 +
 tests/convertt/blankch.sh                          |   1 +
 tests/convertt/fitstojpeg.sh                       |   1 +
 tests/convertt/fitstojpegcmyk.sh                   |   1 +
 tests/convertt/fitstopdf.sh                        |   1 +
 tests/convertt/fitstotxt.sh                        |   1 +
 tests/convertt/jpegtofits.sh                       |   1 +
 tests/convertt/jpegtotxt.sh                        |   1 +
 tests/convolve/frequency.sh                        |   1 +
 tests/convolve/spatial.sh                          |   1 +
 tests/cosmiccal/simpletest.sh                      |   1 +
 tests/crop/cat.txt                                 |   7 +
 tests/crop/imgcat.sh                               |   1 +
 tests/crop/imgcenter.sh                            |   1 +
 tests/crop/imgcenternoblank.sh                     |   1 +
 tests/crop/imgoutpolygon.sh                        |   1 +
 tests/crop/imgpolygon.sh                           |   1 +
 tests/crop/section.sh                              |   1 +
 tests/crop/wcscat.sh                               |   1 +
 tests/crop/wcscenter.sh                            |   1 +
 tests/crop/wcspolygon.sh                           |   1 +
 tests/during-dev.sh                                |  21 +-
 tests/fits/copyhdu.sh                              |   1 +
 tests/fits/delete.sh                               |   1 +
 tests/fits/print.sh                                |   1 +
 tests/fits/update.sh                               |   1 +
 tests/fits/write.sh                                |   1 +
 tests/lib/multithread.sh                           |   1 +
 tests/lib/versioncxx.sh                            |   1 +
 tests/match/merged-cols.sh                         |   1 +
 tests/match/positions-1.txt                        |   7 +
 tests/match/positions-2.txt                        |   7 +
 tests/match/positions.sh                           |   1 +
 tests/mkcatalog/aperturephot.sh                    |   1 +
 tests/mkcatalog/detections.sh                      |   1 +
 tests/mkcatalog/objects-clumps.sh                  |   1 +
 tests/mknoise/addnoise.sh                          |   1 +
 tests/mkprof/clearcanvas.sh                        |   1 +
 tests/mkprof/clearcanvas.txt                       |  11 +-
 tests/mkprof/ellipticalmasks.sh                    |   1 +
 tests/mkprof/ellipticalmasks.txt                   |   7 +
 tests/mkprof/mkprofcat1.txt                        |   7 +
 tests/mkprof/mkprofcat2.txt                        |   7 +
 tests/mkprof/mkprofcat3.txt                        |   7 +
 tests/mkprof/mkprofcat4.txt                        |   7 +
 tests/mkprof/mosaic1.sh                            |   1 +
 tests/mkprof/mosaic2.sh                            |   1 +
 tests/mkprof/mosaic3.sh                            |   1 +
 tests/mkprof/mosaic4.sh                            |   1 +
 tests/mkprof/radeccat.sh                           |   1 +
 tests/mkprof/radeccat.txt                          |   7 +
 tests/noisechisel/noisechisel.sh                   |   1 +
 .../addnoise.sh => script/list-by-night.sh}        |  35 +-
 tests/segment/segment.sh                           |   1 +
 tests/statistics/basicstats.sh                     |   1 +
 tests/statistics/estimate_sky.sh                   |   1 +
 tests/statistics/from-stdin.sh                     |   1 +
 tests/statistics/stdin-input.txt                   |   6 +
 tests/table/fits-ascii-to-txt.sh                   |   1 +
 tests/table/fits-binary-to-txt.sh                  |   1 +
 tests/table/table.txt                              |   7 +-
 tests/table/txt-to-fits-ascii.sh                   |   1 +
 tests/table/txt-to-fits-binary.sh                  |   1 +
 tests/warp/homographic.sh                          |   1 +
 tests/warp/warp_scale.sh                           |   1 +
 163 files changed, 3753 insertions(+), 467 deletions(-)

diff --git a/.autom4te.cfg b/.autom4te.cfg
index bbda037..462af1f 100644
--- a/.autom4te.cfg
+++ b/.autom4te.cfg
@@ -1,6 +1,6 @@
 # Configuration file for autom4te
 # ===============================
-
+#
 # autom4te is used to create the familiar `./configure' script from
 # configure.ac (hand written by Gnuastro developers). autom4te is
 # called during the bootstrapping process (see README-hacking, or the
@@ -13,10 +13,18 @@
 # configuration file, we are asking autom4te to make its cache
 # directory within the bootstrapped directory to keep things on the
 # top directory clean.
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
+
+
 
 # We are using the Autoconf manual's "Customizing autom4te" and
 # "Invoking autom4te" sections as a reference for this file.
-
 begin-language: "Autoconf-without-aclocal-m4"
 args: --cache=./bootstrapped/autom4te.cache
 end-language: "Autoconf-without-aclocal-m4"
\ No newline at end of file
diff --git a/.dir-locals.el b/.dir-locals.el
index af98cc8..25774d2 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -8,6 +8,13 @@
 ;; or the number of spaces to be used for indentation.
 ;;
 ;; For more information see (info "(emacs) Directory Variables")
+;;
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
+;;
+;; Copying and distribution of this file, with or without modification,
+;; are permitted in any medium without royalty provided the copyright
+;; notice and this notice are preserved.  This file is offered as-is,
+;; without any warranty.
 
 ((nil
   (indent-tabs-mode . nil) ;; No tabs as indentation
diff --git a/.gitignore b/.gitignore
index f1f06bd..426315e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,20 @@
 # Files to ignore in version control (Git) -*- conf-unix -*-
 # ==========================================================
-
+#
 # The files satisfying the patterns here (one per line) are ignored by
 # the version control using Git, they are all outputs of the various
 # tools used to built Gnuastro, so we don't need to keep their
 # history.
-
+#
 # To help readability, please add new files based on the length of the line
 # you wish to add.
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 
 
 
diff --git a/.mailmap b/.mailmap
index f8f1c22..90c7765 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1,3 +1,12 @@
+# Map different emails to people in Git.
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
+
 Boud Roukema <boud@cosmo.torun.pl>
 Mohammad Akhlaghi <mohammad@akhlaghi.org>
 <mohammad@akhlaghi.org> <akhlaghi@gnu.org>
diff --git a/COPYING.FDL b/COPYING.FDL
new file mode 100644
index 0000000..9ed23a0
--- /dev/null
+++ b/COPYING.FDL
@@ -0,0 +1,419 @@
+                     GNU FREE DOCUMENTATION LICENSE
+                      Version 1.3, 3 November 2008
+
+Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation,
+Inc. <https://fsf.org/>. Everyone is permitted to copy and distribute
+verbatim copies of this license document, but changing it is not allowed.
+
+0. PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document "free" in the sense of freedom: to assure
+everyone the effective freedom to copy and redistribute it, with or without
+modifying it, either commercially or noncommercially. Secondarily, this
+License preserves for the author and publisher a way to get credit for
+their work, while not being considered responsible for modifications made
+by others.
+
+This License is a kind of "copyleft", which means that derivative works of
+the document must themselves be free in the same sense. It complements the
+GNU General Public License, which is a copyleft license designed for free
+software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free program
+should come with manuals providing the same freedoms that the software
+does. But this License is not limited to software manuals; it can be used
+for any textual work, regardless of subject matter or whether it is
+published as a printed book. We recommend this License principally for
+works whose purpose is instruction or reference.
+
+1. APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that work
+under the conditions stated herein. The "Document", below, refers to any
+such manual or work. Any member of the public is a licensee, and is
+addressed as "you". You accept the license if you copy, modify or
+distribute the work in a way requiring permission under copyright law.
+
+A "Modified Version" of the Document means any work containing the Document
+or a portion of it, either copied verbatim, or with modifications and/or
+translated into another language.
+
+A "Secondary Section" is a named appendix or a front-matter section of the
+Document that deals exclusively with the relationship of the publishers or
+authors of the Document to the Document's overall subject (or to related
+matters) and contains nothing that could fall directly within that overall
+subject. (Thus, if the Document is in part a textbook of mathematics, a
+Secondary Section may not explain any mathematics.) The relationship could
+be a matter of historical connection with the subject or with related
+matters, or of legal, commercial, philosophical, ethical or political
+position regarding them.
+
+The "Invariant Sections" are certain Secondary Sections whose titles are
+designated, as being those of Invariant Sections, in the notice that says
+that the Document is released under this License. If a section does not fit
+the above definition of Secondary then it is not allowed to be designated
+as Invariant. The Document may contain zero Invariant Sections. If the
+Document does not identify any Invariant Sections then there are none.
+
+The "Cover Texts" are certain short passages of text that are listed, as
+Front-Cover Texts or Back-Cover Texts, in the notice that says that the
+Document is released under this License. A Front-Cover Text may be at most
+5 words, and a Back-Cover Text may be at most 25 words.
+
+A "Transparent" copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the general
+public, that is suitable for revising the document straightforwardly with
+generic text editors or (for images composed of pixels) generic paint
+programs or (for drawings) some widely available drawing editor, and that
+is suitable for input to text formatters or for automatic translation to a
+variety of formats suitable for input to text formatters. A copy made in an
+otherwise Transparent file format whose markup, or absence of markup, has
+been arranged to thwart or discourage subsequent modification by readers is
+not Transparent. An image format is not Transparent if used for any
+substantial amount of text. A copy that is not "Transparent" is called
+"Opaque".
+
+Examples of suitable formats for Transparent copies include plain ASCII
+without markup, Texinfo input format, LaTeX input format, SGML or XML using
+a publicly available DTD, and standard-conforming simple HTML, PostScript
+or PDF designed for human modification. Examples of transparent image
+formats include PNG, XCF and JPG. Opaque formats include proprietary
+formats that can be read and edited only by proprietary word processors,
+SGML or XML for which the DTD and/or processing tools are not generally
+available, and the machine-generated HTML, PostScript or PDF produced by
+some word processors for output purposes only.
+
+The "Title Page" means, for a printed book, the title page itself, plus
+such following pages as are needed to hold, legibly, the material this
+License requires to appear in the title page. For works in formats which do
+not have any title page as such, "Title Page" means the text near the most
+prominent appearance of the work's title, preceding the beginning of the
+body of the text.
+
+The "publisher" means any person or entity that distributes copies of the
+Document to the public.
+
+A section "Entitled XYZ" means a named subunit of the Document whose title
+either is precisely XYZ or contains XYZ in parentheses following text that
+translates XYZ in another language. (Here XYZ stands for a specific section
+name mentioned below, such as "Acknowledgements", "Dedications",
+"Endorsements", or "History".) To "Preserve the Title" of such a section
+when you modify the Document means that it remains a section "Entitled XYZ"
+according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this License, but
+only as regards disclaiming warranties: any other implication that these
+Warranty Disclaimers may have is void and has no effect on the meaning of
+this License.
+
+2. VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either commercially
+or noncommercially, provided that this License, the copyright notices, and
+the license notice saying this License applies to the Document are
+reproduced in all copies, and that you add no other conditions whatsoever
+to those of this License. You may not use technical measures to obstruct or
+control the reading or further copying of the copies you make or
+distribute. However, you may accept compensation in exchange for copies. If
+you distribute a large enough number of copies you must also follow the
+conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and you
+may publicly display copies.
+
+3. COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the copies
+in covers that carry, clearly and legibly, all these Cover Texts:
+Front-Cover Texts on the front cover, and Back-Cover Texts on the back
+cover. Both covers must also clearly and legibly identify you as the
+publisher of these copies. The front cover must present the full title with
+all words of the title equally prominent and visible. You may add other
+material on the covers in addition. Copying with changes limited to the
+covers, as long as they preserve the title of the Document and satisfy
+these conditions, can be treated as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit legibly,
+you should put the first ones listed (as many as fit reasonably) on the
+actual cover, and continue the rest onto adjacent pages.
+
+If you publish or distribute Opaque copies of the Document numbering more
+than 100, you must either include a machine-readable Transparent copy along
+with each Opaque copy, or state in or with each Opaque copy a
+computer-network location from which the general network-using public has
+access to download using public-standard network protocols a complete
+Transparent copy of the Document, free of added material. If you use the
+latter option, you must take reasonably prudent steps, when you begin
+distribution of Opaque copies in quantity, to ensure that this Transparent
+copy will remain thus accessible at the stated location until at least one
+year after the last time you distribute an Opaque copy (directly or through
+your agents or retailers) of that edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+4. MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under the
+conditions of sections 2 and 3 above, provided that you release the
+Modified Version under precisely this License, with the Modified Version
+filling the role of the Document, thus licensing distribution and
+modification of the Modified Version to whoever possesses a copy of it. In
+addition, you must do these things in the Modified Version:
+    A. Use in the Title Page (and on the covers, if any) a title distinct
+       from that of the Document, and from those of previous versions
+       (which should, if there were any, be listed in the History section
+       of the Document). You may use the same title as a previous version
+       if the original publisher of that version gives permission.
+    B. List on the Title Page, as authors, one or more persons or entities
+       responsible for authorship of the modifications in the Modified
+       Version, together with at least five of the principal authors of the
+       Document (all of its principal authors, if it has fewer than five),
+       unless they release you from this requirement.
+    C. State on the Title page the name of the publisher of the Modified
+       Version, as the publisher.
+    D. Preserve all the copyright notices of the Document.
+    E. Add an appropriate copyright notice for your modifications adjacent
+       to the other copyright notices.
+    F. Include, immediately after the copyright notices, a license notice
+       giving the public permission to use the Modified Version under the
+       terms of this License, in the form shown in the Addendum below.
+    G. Preserve in that license notice the full lists of Invariant Sections
+       and required Cover Texts given in the Document's license notice.
+    H. Include an unaltered copy of this License.
+    I. Preserve the section Entitled "History", Preserve its Title, and add
+       to it an item stating at least the title, year, new authors, and
+       publisher of the Modified Version as given on the Title Page. If
+       there is no section Entitled "History" in the Document, create one
+       stating the title, year, authors, and publisher of the Document as
+       given on its Title Page, then add an item describing the Modified
+       Version as stated in the previous sentence.
+    J. Preserve the network location, if any, given in the Document for
+       public access to a Transparent copy of the Document, and likewise
+       the network locations given in the Document for previous versions it
+       was based on. These may be placed in the "History" section. You may
+       omit a network location for a work that was published at least four
+       years before the Document itself, or if the original publisher of
+       the version it refers to gives permission.
+    K. For any section Entitled "Acknowledgements" or "Dedications",
+       Preserve the Title of the section, and preserve in the section all
+       the substance and tone of each of the contributor acknowledgements
+       and/or dedications given therein.
+    L. Preserve all the Invariant Sections of the Document, unaltered in
+       their text and in their titles. Section numbers or the equivalent
+       are not considered part of the section titles.
+    M. Delete any section Entitled "Endorsements". Such a section may not
+       be included in the Modified Version.
+    N. Do not retitle any existing section to be Entitled "Endorsements" or
+       to conflict in title with any Invariant Section.
+    O. Preserve any Warranty Disclaimers.
+
+If the Modified Version includes new front-matter sections or appendices
+that qualify as Secondary Sections and contain no material copied from the
+Document, you may at your option designate some or all of these sections as
+invariant. To do this, add their titles to the list of Invariant Sections
+in the Modified Version's license notice. These titles must be distinct
+from any other section titles.
+
+You may add a section Entitled "Endorsements", provided it contains nothing
+but endorsements of your Modified Version by various parties—for example,
+statements of peer review or that the text has been approved by an
+organization as the authoritative definition of a standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list of
+Cover Texts in the Modified Version. Only one passage of Front-Cover Text
+and one of Back-Cover Text may be added by (or through arrangements made
+by) any one entity. If the Document already includes a cover text for the
+same cover, previously added by you or by arrangement made by the same
+entity you are acting on behalf of, you may not add another; but you may
+replace the old one, on explicit permission from the previous publisher
+that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License give
+permission to use their names for publicity for or to assert or imply
+endorsement of any Modified Version.
+
+5. COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified versions,
+provided that you include in the combination all of the Invariant Sections
+of all of the original documents, unmodified, and list them all as
+Invariant Sections of your combined work in its license notice, and that
+you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and multiple
+identical Invariant Sections may be replaced with a single copy. If there
+are multiple Invariant Sections with the same name but different contents,
+make the title of each such section unique by adding at the end of it, in
+parentheses, the name of the original author or publisher of that section
+if known, or else a unique number. Make the same adjustment to the section
+titles in the list of Invariant Sections in the license notice of the
+combined work.
+
+In the combination, you must combine any sections Entitled "History" in the
+various original documents, forming one section Entitled "History";
+likewise combine any sections Entitled "Acknowledgements", and any sections
+Entitled "Dedications". You must delete all sections Entitled
+"Endorsements".
+
+6. COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in the
+collection, provided that you follow the rules of this License for verbatim
+copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute it
+individually under this License, provided you insert a copy of this License
+into the extracted document, and follow this License in all other respects
+regarding verbatim copying of that document.
+
+7. AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate and
+independent documents or works, in or on a volume of a storage or
+distribution medium, is called an "aggregate" if the copyright resulting
+from the compilation is not used to limit the legal rights of the
+compilation's users beyond what the individual works permit. When the
+Document is included in an aggregate, this License does not apply to the
+other works in the aggregate which are not themselves derivative works of
+the Document.
+
+If the Cover Text requirement of section 3 is applicable to these copies of
+the Document, then if the Document is less than one half of the entire
+aggregate, the Document's Cover Texts may be placed on covers that bracket
+the Document within the aggregate, or the electronic equivalent of covers
+if the Document is in electronic form. Otherwise they must appear on
+printed covers that bracket the whole aggregate.
+
+8. TRANSLATION
+
+Translation is considered a kind of modification, so you may distribute
+translations of the Document under the terms of section 4. Replacing
+Invariant Sections with translations requires special permission from their
+copyright holders, but you may include translations of some or all
+Invariant Sections in addition to the original versions of these Invariant
+Sections. You may include a translation of this License, and all the
+license notices in the Document, and any Warranty Disclaimers, provided
+that you also include the original English version of this License and the
+original versions of those notices and disclaimers. In case of a
+disagreement between the translation and the original version of this
+License or a notice or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled "Acknowledgements", "Dedications",
+or "History", the requirement (section 4) to Preserve its Title (section 1)
+will typically require changing the actual title.
+
+9. TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except as
+expressly provided under this License. Any attempt otherwise to copy,
+modify, sublicense, or distribute it is void, and will automatically
+terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license from
+a particular copyright holder is reinstated (a) provisionally, unless and
+until the copyright holder explicitly and finally terminates your license,
+and (b) permanently, if the copyright holder fails to notify you of the
+violation by some reasonable means prior to 60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is reinstated
+permanently if the copyright holder notifies you of the violation by some
+reasonable means, this is the first time you have received notice of
+violation of this License (for any work) from that copyright holder, and
+you cure the violation prior to 30 days after your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under this
+License. If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does not
+give you any rights to use it.
+
+10. FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions of the GNU
+Free Documentation License from time to time. Such new versions will be
+similar in spirit to the present version, but may differ in detail to
+address new problems or concerns. See https://www.gnu.org/licenses/.
+
+Each version of the License is given a distinguishing version number. If
+the Document specifies that a particular numbered version of this License
+"or any later version" applies to it, you have the option of following the
+terms and conditions either of that specified version or of any later
+version that has been published (not as a draft) by the Free Software
+Foundation. If the Document does not specify a version number of this
+License, you may choose any version ever published (not as a draft) by the
+Free Software Foundation. If the Document specifies that a proxy can decide
+which future versions of this License can be used, that proxy's public
+statement of acceptance of a version permanently authorizes you to choose
+that version for the Document.
+
+11. RELICENSING
+
+"Massive Multiauthor Collaboration Site" (or "MMC Site") means any World
+Wide Web server that publishes copyrightable works and also provides
+prominent facilities for anybody to edit those works. A public wiki that
+anybody can edit is an example of such a server. A "Massive Multiauthor
+Collaboration" (or "MMC") contained in the site means any set of
+copyrightable works thus published on the MMC site.
+
+"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license
+published by Creative Commons Corporation, a not-for-profit corporation
+with a principal place of business in San Francisco, California, as well as
+future copyleft versions of that license published by that same
+organization.
+
+"Incorporate" means to publish or republish a Document, in whole or in
+part, as part of another Document.
+
+An MMC is "eligible for relicensing" if it is licensed under this License,
+and if all works that were first published under this License somewhere
+other than this MMC, and subsequently incorporated in whole or in part into
+the MMC, (1) had no cover texts or invariant sections, and (2) were thus
+incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009, provided
+the MMC is eligible for relicensing.
+
+ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of the
+License in the document and put the following copyright and license notices
+just after the title page:
+
+    Copyright (C)  YEAR  YOUR NAME.
+    Permission is granted to copy, distribute and/or modify this document
+    under the terms of the GNU Free Documentation License, Version 1.3
+    or any later version published by the Free Software Foundation;
+    with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+    A copy of the license is included in the section entitled "GNU
+    Free Documentation License".
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the "with … Texts." line with this:
+
+    with the Invariant Sections being LIST THEIR TITLES, with the
+    Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we recommend
+releasing these examples in parallel under your choice of free software
+license, such as the GNU General Public License, to permit their use in
+free software.
diff --git a/ChangeLog b/ChangeLog
index 6de0b71..c709bd8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1113,3 +1113,24 @@
 
        GNU Astronomical Utilities created with the ImageCrop as the first
        package. Other packages will be added in the next few days.
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
+ Copyright (C) 2015-2019, Free Software Foundation, Inc.
+
+ This file is part of GNU Astronomy Utitlies (Gnuastro).
+
+ Gnuastro is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gnuastro is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
diff --git a/Makefile.am b/Makefile.am
index bdca796..49bda39 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,7 +118,7 @@ SUBDIRS = bootstrapped/lib $(MAYBE_GNULIBCHECK) lib 
$(MAYBE_ARITHMETIC)    \
   $(MAYBE_COSMICCAL) $(MAYBE_CROP) $(MAYBE_FITS) $(MAYBE_MATCH)            \
   $(MAYBE_MKCATALOG) $(MAYBE_MKNOISE) $(MAYBE_MKPROF) $(MAYBE_NOISECHISEL) \
   $(MAYBE_SEGMENT) $(MAYBE_STATISTICS) $(MAYBE_TABLE) $(MAYBE_TEMPLATE)    \
-  $(MAYBE_WARP) doc tests
+  $(MAYBE_WARP) bin/script doc tests
 
 
 
@@ -142,8 +142,12 @@ dist_sysconf_DATA = bin/gnuastro.conf
 
 ## Files that are only distributed
 ## ===============================
-EXTRA_DIST = genauthors .dir-locals.el .version developer-build     \
-  bootstrapped/README .autom4te.cfg
+##
+## Note that `COPYING' (containing the GNU GPL) is included in the
+## distribution tarball by default in Automake, but not other license
+## files, so we have to manually add `COPYING.FDL'.
+EXTRA_DIST = COPYING.FDL genauthors .dir-locals.el .version \
+             developer-build bootstrapped/README .autom4te.cfg
 
 
 
diff --git a/NEWS b/NEWS
index 29a09bc..6a99ad9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,24 @@
 GNU Astronomy Utilities NEWS                          -*- outline -*-
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
 
-* Noteworthy changes in release X.X (library X.X.X) (YYYY-MM-DD) [stable]
+* Noteworthy changes in release X.X (library X.X.X) (XXXX-XX-XX) [stable]
+
+** New features
+
+** Removed features
+
+** Changed features
+
+** Bugs fixed
+  bug #56195: astscript-sort-by-night crashing because of AWK.
+
+
+
+
+
+* Noteworthy changes in release 0.9 (library 7.0.0) (2019-04-17) [stable]
 
 ** New features
 
@@ -17,14 +34,18 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
      operand into a file. They can be very handy in debugging/understanding
      an Arithmetic command (especially as it gets complicated), or to
      produce multiple files/extensions with a single call to Arithmetic.
-   - Four new operators have beed added to allow coadding multiple datasets
+   - Four new operators have been added to allow coadding multiple datasets
      into one using sigma-clipping: `sigclip-number', `sigclip-mean',
      `sigclip-median', and `sigclip-std'. These are very useful when
      several inputs have strong outliers that affect the median, or the
      mean is required.
+   - Multithreaded operation for the following operators that
+     combine/co-add multiple inputs into one output with same size: `min',
+     `max', `number', `sum', `mean', `std', `median', `sigclip-number',
+     `sigclip-median', `sigclip-mean', `sigclip-std'.
    --wcsfile and --wcshdu: these two options can be used to specify a
      different file for reading the WCS of the output. This is useful when
-     the default (theh WCS of the first dataset that is read) is not the
+     the default (the WCS of the first dataset that is read) is not the
      required one.
    --interpmetric: new option that is necessary with the
      `interpolate-medianngb' operator. For more, see the description of
@@ -32,13 +53,21 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 
   Fits:
    - Add "title" to group FITS keywords with `--write=/,"title name". This
-     "title" is composed of two keyword records: a blank one, followed by
-     another starting with `/' and ending in any string given to this
-     option. Classifying the keywords into contextually similar groups
-     greatly helps in visual inspection and is ecouraged.
+     "title" is composed of two keyword records/lines: a blank one (all
+     whitespace), followed by another starting with `/' and ending in any
+     string given to this option. This visually separates the keywords and
+     acts as a title. Classifying the keywords into contextually similar
+     groups greatly helps in visual inspection and is encouraged.
    - Calculate and write `CHECKSUM' and `DATASUM' integrity keywords into
      the specified header using `--write=checksum' (for both) or
      `--write=datasum' (only for `DATASUM').
+   --datetosec: Convert the FITS date format (old or new) to number of
+     seconds since since the Unix epoch time (1970-01-01,00:00:00). The
+     FITS date format (for example `YYYY-MM-DDThh:mm:ss') is hard to use
+     for automatic processing (requires calendar peculiarities like number
+     of days in each month, or leap years and etc). With this option a
+     single integer is returned that can be used for example to sort FITS
+     files by date keywords without worrying about calendar peculiarities.
    --verify: confirm if the `DATASUM' and `CHECKSUM' keyword values agree
      with the specified HDU's content and/or data.
    --copykeys: Copy several keyword records (in a given range) from one
@@ -50,7 +79,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
      any of the columns of the second using the special `_all' name of
      `--outcols'. For example the output of `--outcols=a_all,b5' will
      contain all the columns from the first input and the 5th column of the
-     second input. This greatly simplifies the mergining of different table
+     second input. This greatly simplifies the merging of different table
      columns into one.
    --coord: manually specify coordinates to match on the
      command-line. Until now, if you only wanted to make check a specific
@@ -85,13 +114,42 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   Statistics:
    --interpmetric: Similar to NoiseChisel.
 
+  Table:
+   --range: Limit the output rows to those with a value within the given
+     numeric range with this format: `--range=COL,low,high'. This is very
+     useful when only certain rows of the input are required not the
+     output. The advantage over piping to AWK is that you can save the
+     output directly to FITS (preserving the metadata). See the book for
+     more.
+   --sort: Sort the output rows based on the value of the given column in
+     ascending order.
+   --descending: When called with `--sort', will arrange the output rows in
+     descending order.
+
+  Installed scripts:
+   With this release, Gnuastro also installs Bash scripts for common
+   higher-level usage of (possibly multiple) programs. These scripts have a
+   `astscript-*' name, to easily show up on the command-line as Gnuastro
+   executables with the other Gnuastro programs, but are identifiable from
+   them. They support options just like the programs (which can be listed
+   with `--help'). Please see the new "Installed scripts" chapter of the
+   book for more.
+   - astscript-sort-by-night: New Gnuastro executable, using Gnuastro's
+     Fits program to identify files with dates in the same night (possibly
+     spanning two calendar dates).
+
   Library:
     GAL_BLANK_LONG: new macro for the `long' type blank value.
     GAL_BLANK_ULONG: new macro for the `unsigned long' type blank value.
     gal_blank_number: Return the number of blank elements in a dataset.
     gal_dimension_dist_radial: Radial distance between two coordinates.
+    gal_fits_key_date_to_struct_tm: FITS date format to C broken-down time.
+    gal_fits_key_date_to_seconds: FITS date format to Unix epoch time.
+    gal_qsort_index_single_TYPE_i: Set of functions to sort indexs ascending.
+    gal_qsort_index_single_TYPE_d: Set of functions to sort indexs descending.
     gal_statistics_outlier_cumulative: Uses flatness of the cumulative
        distribution to find outliers.
+    gal_table_list_of_indexs: returns the list of indexs matching columns.
     gal_type_is_int: to see if we have an integer (any width, any sign).
 
 ** Removed features
@@ -130,6 +188,16 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   Statistics:
    --ignoreblankintiles: similar to same option in NoiseChisel.
 
+  Table:
+   --colinfoinstdout: now corresponds to the `-O' short option. Until this
+     version, the `-s' short option was used for it. But with the new
+     `--sort' option, `-s' may cause confusion.
+
+  Library
+   gal_arithmetic: new argument: number of threads to use (when relevant).
+   gal_eps_write: new argument: optional bit-optimization with `dontoptimize'.
+   gal_pdf_write: new argument: optional bit-optimization with `dontoptimize'.
+
 ** Bugs fixed
   bug #55313: Fits program writing --write values in reverse order
   bug #55333: Fits program crash when --write or --update have no value.
@@ -139,6 +207,13 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   bug #55544: Arithmetic's output WCS with where operator is not as expected.
   bug #55740: Diamond shapes in nearst-ngb interpolation affecting NoiseChisel.
   bug #55763: Crop not keeping Blank pixels on unsigned types.
+  bug #55844: WCS library (and thus all programs) can't deal with CROTAi 
values.
+  bug #55845: Crash when necessary column not found from standard input.
+  bug #55988: MakeProfiles segfault when input catalog has no rows.
+  bug #56001: Bad tile sizes with only one tile and small remainder.
+  bug #56048: Crash when WCS cannot be written to FITS file.
+
+
 
 
 
@@ -1485,3 +1560,15 @@ GNU Astronomy Utilities NEWS                          
-*- outline -*-
   All the build steps now report what was done and suggest the next
   step. This feature can be disabled with the `--disable-guide-message' at
   configure time.
+
+
+
+
+
+* Copyright notice
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
diff --git a/README b/README
index 94d965a..de215bf 100644
--- a/README
+++ b/README
@@ -1,6 +1,9 @@
 GNU Astronomy Utilities
 =======================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 GNU Astronomy Utilities (Gnuastro) is an official GNU package of programs
 and a library functions for astronomical data manipulation and
 analysis. The programs are run directory on the operating system's
@@ -96,6 +99,16 @@ categories/chapters.
   - Warp (astwarp): Warp image to new pixel grid. Any projective
     transformation or Homography can be applied to the input images.
 
+The programs listed above are designed to be highly modular and
+generic. For higher-level operations (combining multiple programs, or
+running a program in a special way), Gnuastro also installs Bash scripts
+(all prefixed with `astscript-'). They can be run like a program and behave
+very similarly (with minor differences, as explained in the book).
+
+  - astscript-sort-by-night: Given a list of FITS files, and a HDU and
+    keyword name for a date, this script separates the files in the same
+    night (possibly over two calendar days).
+
 All the programs share the same basic command-line user interface and a set
 of common options for the comfort of both the users and
 developers. Gnuastro is written to comply fully with the GNU coding
@@ -229,3 +242,16 @@ along with their status can be seen here
 Have a look in the link above to see if your problem has already been
 addressed. Click on "Display Criteria" and choose the "Category" of your
 bug for a shorter and more relevant list to look into.
+
+
+
+
+
+Copyright information
+---------------------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/README-hacking b/README-hacking
index b49b2f4..97648a5 100644
--- a/README-hacking
+++ b/README-hacking
@@ -1,6 +1,9 @@
 Hacking into GNU Astronomy Utilities
 ====================================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 This file is intended for those who are building and installing the version
 controlled source of GNU Astronomy Utilities (Gnuastro) and not the tarball
 release (see the 'README' file for the easier tarball installation and
@@ -104,4 +107,16 @@ CAUTION
 This file ('README-hacking') is only distributed with the version
 controlled source and not the Gnuastro tarball. Without this file, the
 'bootstrap' script will complain about not being checked-out and abort. So
-be sure to keep this file where ever you want to run 'bootstrap'.
\ No newline at end of file
+be sure to keep this file where ever you want to run 'bootstrap'.
+
+
+
+Copyright information
+---------------------
+
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/THANKS b/THANKS
index c803745..557cd3a 100644
--- a/THANKS
+++ b/THANKS
@@ -1,6 +1,9 @@
 GNU Astronomy Utilities Acknowledgments
 =======================================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 The following people and institutions who contributed to Gnuastro
 indirectly (not by actually submitting code) are listed here. For the list
 of Gnuastro code/documentation authors (people who have contributed actual
@@ -30,6 +33,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Nima Dehdilani                       nimadehdilani@gmail.com
     Antonio Diaz Diaz                    antonio@gnu.org
     Pierre-Alain Duc                     pierre-alain.duc@astro.unistra.fr
+    Elham Eftekhari                      elhamea@iac.es
     Gaspar Galaz                         ggalaz@astro.puc.cl
     Thérèse Godefroy                     godef.th@free.fr
     Madusha Gunawardhana                 gunawardhana@strw.leidenuniv.nl
@@ -39,7 +43,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Brandon Invergo                      brandon@gnu.org
     Oryna Ivashtenko                     arinaivashtenko@gmail.com
     Aurélien Jarno                       aurelien.jarno@univ-lyon1.fr
-    Lee Kelvin                           l.s.kelvin@ljmu.ac.uk
+    Lee Kelvin                           lee.s.kelvin@gmail.com
     Brandon Kelly                        b.k.kelly@2017.ljmu.ac.uk
     Mohammad-Reza Khellat                moha.khe@gmail.com
     Johan Knapen                         jhk@iac.es
@@ -92,3 +96,14 @@ Host institutions of Gnuastro's developers.
     University of Salento, Lecce, Italy.
     Centre de Recherche Astrophysique de Lyon (CRAL), Lyon, France.
     Instituto de Astrofisica de Canarias (IAC), Tenerife, Spain.
+
+
+Copyright
+---------
+
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/bin/TEMPLATE/astTEMPLATE.conf b/bin/TEMPLATE/astTEMPLATE.conf
index 3fe97e1..d10efb4 100644
--- a/bin/TEMPLATE/astTEMPLATE.conf
+++ b/bin/TEMPLATE/astTEMPLATE.conf
@@ -12,6 +12,8 @@
 #  $ info astTEMPLATE                    # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index b221ce9..0c60cdb 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -431,7 +431,7 @@ wrapper_for_filter(struct arithmeticparams *p, char *token, 
int operator)
                   "along dimension %zu is a float", ndim-i);
 
           /* Make sure it isn't negative. */
-          comp=gal_arithmetic(GAL_ARITHMETIC_OP_GT, 0, tmp, zero);
+          comp=gal_arithmetic(GAL_ARITHMETIC_OP_GT, 1, 0, tmp, zero);
           if( *(uint8_t *)(comp->array) == 0 )
             error(EXIT_FAILURE, 0, "lengths of filter along dimensions "
                   "must be positive. The given length in dimension %zu"
@@ -907,8 +907,8 @@ reversepolish(struct arithmeticparams *p)
   int op=0, nop=0;
   unsigned int numop, i;
   gal_list_str_t *token;
+  gal_data_t *d1, *d2, *d3;
   char *hdu, *filename, *printnum;
-  gal_data_t *d1=NULL, *d2=NULL, *d3=NULL;
   int flags = ( GAL_ARITHMETIC_INPLACE | GAL_ARITHMETIC_FREE
                 | GAL_ARITHMETIC_NUMOK );
 
@@ -942,7 +942,6 @@ reversepolish(struct arithmeticparams *p)
         operands_add(p, NULL, d1);
       else
         {
-
           /* Order is the same as in the manual. */
           /* Simple arithmetic operators. */
           if      (!strcmp(token->v, "+" ))
@@ -1097,14 +1096,15 @@ reversepolish(struct arithmeticparams *p)
             { op=ARITHMETIC_OP_COLLAPSE_MEAN;         nop=0; }
           else if (!strcmp(token->v, "collapse-number"))
             { op=ARITHMETIC_OP_COLLAPSE_NUMBER;       nop=0; }
-
-
-          /* Finished checks with known operators */
           else
             error(EXIT_FAILURE, 0, "the argument \"%s\" could not be "
                   "interpretted as a file name, named dataset, number, or "
                   "operator", token->v);
 
+          /* Initialize all the operand pointers (they may be remaining
+             from previous operators and we don't want them to cause
+             confusion. */
+          d1 = d2 = d3 = NULL;
 
           /* See if the arithmetic library must be called or not. */
           if(nop)
@@ -1138,7 +1138,6 @@ reversepolish(struct arithmeticparams *p)
                      integer number, we will use that to construct a linked
                      list of any number of operands within the single `d1'
                      pointer. */
-                  d1=NULL;
                   numop=pop_number_of_operands(p, op, token->v, &d2);
                   for(i=0;i<numop;++i)
                     gal_list_data_add(&d1, operands_pop(p, token->v));
@@ -1154,7 +1153,8 @@ reversepolish(struct arithmeticparams *p)
                  number of arguments it uses depend on the operator. So
                  when the operator doesn't need three operands, the extra
                  arguments will be ignored. */
-              operands_add(p, NULL, gal_arithmetic(op, flags, d1, d2, d3));
+              operands_add(p, NULL, gal_arithmetic(op, p->cp.numthreads,
+                                                   flags, d1, d2, d3));
             }
 
           /* No need to call the arithmetic library, call the proper
diff --git a/bin/arithmetic/astarithmetic.conf 
b/bin/arithmetic/astarithmetic.conf
index ff83a14..5baa1ab 100644
--- a/bin/arithmetic/astarithmetic.conf
+++ b/bin/arithmetic/astarithmetic.conf
@@ -12,6 +12,8 @@
 #  $ info astarithmetic                  # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/arithmetic/ui.c b/bin/arithmetic/ui.c
index f08d5c1..0ef9a24 100644
--- a/bin/arithmetic/ui.c
+++ b/bin/arithmetic/ui.c
@@ -33,6 +33,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <gnuastro/fits.h>
 #include <gnuastro/table.h>
 #include <gnuastro/array.h>
+#include <gnuastro/threads.h>
 
 #include <gnuastro-internal/timing.h>
 #include <gnuastro-internal/options.h>
@@ -124,6 +125,7 @@ ui_initialize_options(struct arithmeticparams *p,
   cp->program_exec       = PROGRAM_EXEC;
   cp->program_bibtex     = PROGRAM_BIBTEX;
   cp->program_authors    = PROGRAM_AUTHORS;
+  cp->numthreads         = gal_threads_number();
   cp->coptions           = gal_commonopts_options;
 
   /* Modify the common options. */
diff --git a/bin/buildprog/astbuildprog.conf.in 
b/bin/buildprog/astbuildprog.conf.in
index 8eb1386..6d3f3cd 100644
--- a/bin/buildprog/astbuildprog.conf.in
+++ b/bin/buildprog/astbuildprog.conf.in
@@ -12,6 +12,8 @@
 #  $ info astbuildprog                   # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/convertt/astconvertt.conf b/bin/convertt/astconvertt.conf
index 493bb6a..07603d3 100644
--- a/bin/convertt/astconvertt.conf
+++ b/bin/convertt/astconvertt.conf
@@ -12,6 +12,8 @@
 #  $ info astconvertt                    # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/convertt/convertt.c b/bin/convertt/convertt.c
index 3ffb66d..b02971f 100644
--- a/bin/convertt/convertt.c
+++ b/bin/convertt/convertt.c
@@ -72,11 +72,11 @@ convertt_change(struct converttparams *p)
       {
         /* Make a condition array: all pixels with a value equal to
            `change->from' will be set as 1 in this array. */
-        cond=gal_arithmetic(GAL_ARITHMETIC_OP_EQ, GAL_ARITHMETIC_NUMOK,
+        cond=gal_arithmetic(GAL_ARITHMETIC_OP_EQ, 1, GAL_ARITHMETIC_NUMOK,
                             channel, change->from);
 
         /* Now, use the condition array to set the proper values. */
-        channel=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, flags, channel,
+        channel=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, 1, flags, channel,
                                cond, change->to);
 
         /* Clean up, since we set the free flag, all extra arrays have been
@@ -104,11 +104,11 @@ convertt_trunc_function(int operator, gal_data_t *data, 
gal_data_t *value)
 
   /* Make a condition array: all pixels with a value equal to
      `change->from' will be set as 1 in this array. */
-  cond=gal_arithmetic(operator, GAL_ARITHMETIC_NUMOK, data, value);
+  cond=gal_arithmetic(operator, 1, GAL_ARITHMETIC_NUMOK, data, value);
 
 
   /* Now, use the condition array to set the proper values. */
-  out=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, flags, data, cond, value);
+  out=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, 1, flags, data, cond, value);
 
 
   /* A small sanity check. The process must be in-place so the original
@@ -200,8 +200,8 @@ convertt_scale_to_uchar(struct converttparams *p)
             }
 
           /* Calculate the minimum and maximum. */
-          mind = gal_arithmetic(GAL_ARITHMETIC_OP_MINVAL, 0, channel);
-          maxd = gal_arithmetic(GAL_ARITHMETIC_OP_MAXVAL, 0, channel);
+          mind = gal_arithmetic(GAL_ARITHMETIC_OP_MINVAL, 1, 0, channel);
+          maxd = gal_arithmetic(GAL_ARITHMETIC_OP_MAXVAL, 1, 0, channel);
           tmin = *((float *)(mind->array));
           tmax = *((float *)(maxd->array));
           gal_data_free(mind);
@@ -240,7 +240,6 @@ convertt_scale_to_uchar(struct converttparams *p)
   m=(float)maxbyte/(max-min);
 
 
-
   /* Convert all the non-blank channels to unsigned char. */
   prev=NULL;
   for(channel=p->chll; channel!=NULL; channel=channel->next)
@@ -282,7 +281,6 @@ convertt_scale_to_uchar(struct converttparams *p)
 
       /* Set the prev pointer. */
       prev=channel;
-
     }
 }
 
@@ -365,13 +363,14 @@ convertt(struct converttparams *p)
     case OUT_FORMAT_EPS:
       if(!p->colormap) convertt_scale_to_uchar(p);
       gal_eps_write(p->chll, p->cp.output, p->widthincm, p->borderwidth,
-                    p->hex, 0);
+                    p->hex, p->forcemin || p->forcemax, 0);
       break;
 
     /* PDF */
     case OUT_FORMAT_PDF:
       if(!p->colormap) convertt_scale_to_uchar(p);
-      gal_pdf_write(p->chll, p->cp.output, p->widthincm, p->borderwidth);
+      gal_pdf_write(p->chll, p->cp.output, p->widthincm, p->borderwidth,
+                    p->forcemin || p->forcemax);
       break;
 
     /* Not recognized. */
diff --git a/bin/convertt/ui.c b/bin/convertt/ui.c
index 71bcc0d..284801c 100644
--- a/bin/convertt/ui.c
+++ b/bin/convertt/ui.c
@@ -332,7 +332,7 @@ ui_read_check_only_options(struct converttparams *p)
 
   if(p->fluxhighstr && p->fluxlowstr)
     {
-      cond=gal_arithmetic(GAL_ARITHMETIC_OP_GT, GAL_ARITHMETIC_NUMOK,
+      cond=gal_arithmetic(GAL_ARITHMETIC_OP_GT, 1, GAL_ARITHMETIC_NUMOK,
                           p->fluxhigh, p->fluxlow);
 
       if( *((unsigned char *)cond->array) == 0 )
diff --git a/bin/convolve/astconvolve.conf b/bin/convolve/astconvolve.conf
index 1ff2e7d..fd78edc 100644
--- a/bin/convolve/astconvolve.conf
+++ b/bin/convolve/astconvolve.conf
@@ -12,6 +12,8 @@
 #  $ info astconvolve                    # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/convolve/ui.c b/bin/convolve/ui.c
index ca8ce78..9b34719 100644
--- a/bin/convolve/ui.c
+++ b/bin/convolve/ui.c
@@ -567,11 +567,11 @@ ui_preparations(struct convolveparams *p)
              meaningful. */
           sum=gal_statistics_sum(p->input);
           sum=gal_data_copy_to_new_type_free(sum, GAL_TYPE_FLOAT32);
-          p->input = gal_arithmetic(GAL_ARITHMETIC_OP_DIVIDE,
+          p->input = gal_arithmetic(GAL_ARITHMETIC_OP_DIVIDE, 1,
                                     GAL_ARITHMETIC_FLAGS_ALL, p->input, sum);
           sum=gal_statistics_sum(p->kernel);
           sum=gal_data_copy_to_new_type_free(sum, GAL_TYPE_FLOAT32);
-          p->kernel = gal_arithmetic(GAL_ARITHMETIC_OP_DIVIDE,
+          p->kernel = gal_arithmetic(GAL_ARITHMETIC_OP_DIVIDE, 1,
                                      GAL_ARITHMETIC_FLAGS_ALL, p->kernel, sum);
         }
     }
diff --git a/bin/cosmiccal/astcosmiccal.conf b/bin/cosmiccal/astcosmiccal.conf
index b2644b1..e40222e 100644
--- a/bin/cosmiccal/astcosmiccal.conf
+++ b/bin/cosmiccal/astcosmiccal.conf
@@ -12,6 +12,8 @@
 #  $ info astcosmiccal                   # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/cosmiccal/cosmiccal.c b/bin/cosmiccal/cosmiccal.c
index 2295e55..e58a834 100644
--- a/bin/cosmiccal/cosmiccal.c
+++ b/bin/cosmiccal/cosmiccal.c
@@ -61,7 +61,7 @@ cosmiccal_print_input(struct cosmiccalparams *p)
          p->olambda);
   printf(FLTFORMAT, "Matter fractional density, now:", p->omatter);
   printf(EXPFORMAT, "Radiation fractional density, now:", p->oradiation);
-  printf(EXPFORMAT, "Curvatue fractional density (from the above):",
+  printf(EXPFORMAT, "Curvature fractional density (from the above):",
          1 - ( p->olambda + p->omatter + p->oradiation ));
 }
 
diff --git a/bin/crop/astcrop.conf b/bin/crop/astcrop.conf
index 998015b..07f701d 100644
--- a/bin/crop/astcrop.conf
+++ b/bin/crop/astcrop.conf
@@ -12,6 +12,8 @@
 #  $ info astcrop                        # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/crop/wcsmode.c b/bin/crop/wcsmode.c
index 4fd0686..abedaed 100644
--- a/bin/crop/wcsmode.c
+++ b/bin/crop/wcsmode.c
@@ -105,6 +105,9 @@ wcsmode_check_prepare(struct cropparams *p, struct 
inputimgs *img)
      small differences might exist in the pixel scale, so break out with an
      error only if the pixel scales are more different than 1e-6. */
   pixscale=gal_wcs_pixel_scale(wcs);
+  if(pixscale==NULL)
+    error(EXIT_FAILURE, 0, "the pixel scale couldn't be deduced from the "
+          "WCS");
   if( fabs(pixscale[0]-pixscale[1])/pixscale[0] > 1e-6 )
     error(EXIT_FAILURE, 0, "%s: HDU %s: The pixel scale along "
           "the two image axises is not the same. The first axis "
diff --git a/bin/fits/args.h b/bin/fits/args.h
index 281a65b..5f3d899 100644
--- a/bin/fits/args.h
+++ b/bin/fits/args.h
@@ -92,6 +92,8 @@ struct argp_option program_options[] =
 
 
 
+
+
     {
       0, 0, 0, 0,
       "Keywords (in one HDU):",
@@ -230,7 +232,7 @@ struct argp_option program_options[] =
     {
       "copykeys",
       UI_KEY_COPYKEYS,
-      "STR",
+      "INT:INT",
       0,
       "Range of keywords to copy to output HDU.",
       UI_GROUP_KEYWORD,
@@ -240,6 +242,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "datetosec",
+      UI_KEY_DATETOSEC,
+      "STR",
+      0,
+      "FITS date to sec from 1970/01/01T00:00:00",
+      UI_GROUP_KEYWORD,
+      &p->datetosec,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
 
 
 
diff --git a/bin/fits/astfits.conf b/bin/fits/astfits.conf
index cd3fe2f..a69b5d9 100644
--- a/bin/fits/astfits.conf
+++ b/bin/fits/astfits.conf
@@ -12,6 +12,8 @@
 #  $ info astfits                        # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/fits/fits.c b/bin/fits/fits.c
index 24e58ec..432bbbd 100644
--- a/bin/fits/fits.c
+++ b/bin/fits/fits.c
@@ -109,17 +109,17 @@ fits_print_extension_info(struct fitsparams *p)
   /* Allocate all the columns (in reverse order, since this is a simple
      linked list). */
   gal_list_data_add_alloc(&cols, NULL, GAL_TYPE_STRING, 1, &numext, NULL, 1,
-                          p->cp.minmapsize, "HDU_SIZE", "name", "Size of "
-                          "image or table number of rows and columns.");
+                          -1, "HDU_SIZE", "name", "Size of image or table "
+                          "number of rows and columns.");
   gal_list_data_add_alloc(&cols, NULL, GAL_TYPE_STRING, 1, &numext, NULL, 1,
-                          p->cp.minmapsize, "HDU_TYPE", "name", "Image "
-                          "data type or `table' format (ASCII or binary).");
+                          -1, "HDU_TYPE", "name", "Image data type or "
+                          "`table' format (ASCII or binary).");
   gal_list_data_add_alloc(&cols, NULL, GAL_TYPE_STRING, 1, &numext, NULL, 1,
-                          p->cp.minmapsize, "EXTNAME", "name",
-                          "Extension name of this HDU (EXTNAME in FITS).");
+                          -1, "EXTNAME", "name", "Extension name of this "
+                          "HDU (EXTNAME in FITS).");
   gal_list_data_add_alloc(&cols, NULL, GAL_TYPE_UINT16, 1, &numext, NULL, 1,
-                          p->cp.minmapsize, "HDU_INDEX", "count", "Index "
-                          "(starting from zero) of each HDU (extension).");
+                          -1, "HDU_INDEX", "count", "Index (starting from "
+                          "zero) of each HDU (extension).");
 
 
   /* Keep pointers to the array of each column for easy writing. */
diff --git a/bin/fits/keywords.c b/bin/fits/keywords.c
index c7e6fe2..61bb435 100644
--- a/bin/fits/keywords.c
+++ b/bin/fits/keywords.c
@@ -397,6 +397,40 @@ keywords_copykeys(struct fitsparams *p, char *inkeys, 
size_t numinkeys)
 
 
 
+static void
+keywords_date_to_seconds(struct fitsparams *p, fitsfile *fptr)
+{
+  int status=0;
+  double subsec;
+  size_t seconds;
+  char *subsecstr;
+  char fitsdate[FLEN_KEYWORD];
+
+  /* Read the requested FITS keyword. */
+  if( fits_read_key(fptr, TSTRING, p->datetosec, &fitsdate, NULL, &status) )
+    gal_fits_io_error(status, NULL);
+
+  /* Return the number of seconds (and subseconds) that it corresponds
+     to. */
+  seconds=gal_fits_key_date_to_seconds(fitsdate, &subsecstr, &subsec);
+
+  /* Print the result (for the sub-seconds, print everything after the */
+  if( !p->cp.quiet )
+    {
+      printf("%s (hdu %s), key `%s': %s\n", p->filename, p->cp.hdu,
+             p->datetosec, fitsdate);
+      printf("Seconds since 1970/01/01 (00:00:00): %zu%s\n\n", seconds,
+             subsecstr);
+      printf("(To suppress verbose output, run with `-q')\n");
+    }
+  else
+    printf("%ld%s\n", seconds, subsecstr);
+}
+
+
+
+
+
 
 
 
@@ -554,6 +588,14 @@ keywords(struct fitsparams *p)
     }
 
 
+  /* Convert the FITS date string into seconds. */
+  if(p->datetosec)
+    {
+      keywords_open(p, &fptr, READONLY);
+      keywords_date_to_seconds(p, fptr);
+    }
+
+
   /* Close the FITS file */
   if(fits_close_file(fptr, &status))
     gal_fits_io_error(status, NULL);
diff --git a/bin/fits/main.h b/bin/fits/main.h
index 6d27a8c..460a067 100644
--- a/bin/fits/main.h
+++ b/bin/fits/main.h
@@ -72,6 +72,7 @@ struct fitsparams
   gal_list_str_t *comment;     /* COMMENT value.                        */
   uint8_t         *verify;     /* Verify the CHECKSUM and DATASUM keys. */
   char          *copykeys;     /* Range of keywords to copy in output.  */
+  char         *datetosec;     /* Convert FITS date to seconds.         */
   uint8_t     quitonerror;     /* Quit if an error occurs.              */
 
   /* Internal: */
diff --git a/bin/fits/ui.c b/bin/fits/ui.c
index fdbe637..1d69fd4 100644
--- a/bin/fits/ui.c
+++ b/bin/fits/ui.c
@@ -221,9 +221,15 @@ ui_check_copykeys(struct fitsparams *p)
 {
   long read;
   char *tailptr;
-  size_t group=0;
+  /* size_t group=0; */
   char forl='f', *pt=p->copykeys;
 
+  /* For copykeys, an output filename is mandatory. */
+  if(p->cp.output==NULL || p->outhdu==NULL)
+    error(EXIT_FAILURE, 0, "an output FITS extension (in an existing "
+          "FITS file, specified with the `--output' and `--outhdu') are "
+          "mandatory for running `--copykeys'");
+
   /* Initialize the values. */
   p->copykeysrange[0]=p->copykeysrange[1]=GAL_BLANK_LONG;
 
@@ -251,20 +257,19 @@ ui_check_copykeys(struct fitsparams *p)
         case '6': case '7': case '8': case '9': case '-':
           break;
 
-        /* An un-recognized character should crash the program. */
+        /* Identifier for next group of ranges. However, For the time
+           being, we just support one group. So we are commenting the break
+           here for it to follow onto default.
         case ',':
           ++group;
           forl='f';
           ++pt;
-
-          /* For the time being, we just support one group. So we are
-             commenting the break here for it to follow onto default.
           break;
           */
         default:
           error(EXIT_FAILURE, 0, "value to `--copykeys' must only contain "
                 "integer numbers and these special characters between them: "
-                "`,', `:', `*' when necessary. But it is `%s' (the first "
+                "`:' when necessary. But it is `%s' (the first "
                 "non-acceptable character is `%c').\n", p->copykeys, *pt);
           break;
         }
@@ -319,7 +324,7 @@ ui_read_check_only_options(struct fitsparams *p)
      mode flag to keyword-mode. */
   if( p->date || p->comment || p->history || p->asis || p->delete
       || p->rename || p->update || p->write || p->verify || p->printallkeys
-      || p->copykeys )
+      || p->copykeys || p->datetosec )
     {
       /* Set the mode. */
       p->mode=FITS_MODE_KEY;
@@ -360,6 +365,14 @@ ui_read_check_only_options(struct fitsparams *p)
                                                    "_ext.fits");
     }
 
+  /* Currently `datetosec' must be called alone. */
+  if( p->datetosec
+      && (p->date || p->comment || p->history || p->asis || p->delete
+          || p->rename || p->update || p->write || p->verify
+          || p->printallkeys || p->copykeys || p->mode==FITS_MODE_HDU) )
+    error(EXIT_FAILURE, 0, "`--datetosec' cannot currently be called with "
+          "any other option");
+
   /* If no options are given, go into HDU mode, which will print the HDU
      information when nothing is asked. */
   if(p->mode==FITS_MODE_INVALID)
diff --git a/bin/fits/ui.h b/bin/fits/ui.h
index 582a03c..229cc61 100644
--- a/bin/fits/ui.h
+++ b/bin/fits/ui.h
@@ -43,7 +43,7 @@ enum program_args_groups
 
 /* Available letters for short options:
 
-   b e f g i j l m s x y z
+   b e f g i j l m x y z
    A B E G J L O W X Y
  */
 enum option_keys_enum
@@ -64,6 +64,7 @@ enum option_keys_enum
   UI_KEY_DATE         = 't',
   UI_KEY_VERIFY       = 'v',
   UI_KEY_QUITONERROR  = 'Q',
+  UI_KEY_DATETOSEC    = 's',
 
 
   /* Only with long version (start with a value 1000, the rest will be set
diff --git a/bin/gnuastro.conf b/bin/gnuastro.conf
index a901b99..42f9a84 100644
--- a/bin/gnuastro.conf
+++ b/bin/gnuastro.conf
@@ -12,6 +12,8 @@
 # NOTE I:  All counting is from zero, not one.
 # NOTE II: Lines starting with `#` are ignored.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
 # notice and this notice are preserved.  This file is offered as-is,
diff --git a/bin/match/astmatch.conf b/bin/match/astmatch.conf
index 85a90ec..5e269f0 100644
--- a/bin/match/astmatch.conf
+++ b/bin/match/astmatch.conf
@@ -12,6 +12,8 @@
 #  $ info astmatch                       # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/match/match.c b/bin/match/match.c
index e32a74b..7dca0ab 100644
--- a/bin/match/match.c
+++ b/bin/match/match.c
@@ -437,10 +437,10 @@ match_catalog(struct matchparams *p)
   /* Print the number of matches if not in quiet mode. */
   if(!p->cp.quiet)
     {
-      fprintf(stdout, "Number of maching rows in both catalogs: %zu\n",
+      fprintf(stdout, "Number of matching rows in both catalogs: %zu\n",
               nummatched);
       if(p->out2name && strcmp(p->out1name, p->out2name))
-        fprintf(stdout, "Output:\n %s\n %s", p->out1name, p->out2name);
+        fprintf(stdout, "Output:\n %s\n %s\n", p->out1name, p->out2name);
       else
         fprintf(stdout, "Output: %s\n", p->out1name);
     }
diff --git a/bin/mkcatalog/astmkcatalog.conf b/bin/mkcatalog/astmkcatalog.conf
index 79a9ce2..19c417a 100644
--- a/bin/mkcatalog/astmkcatalog.conf
+++ b/bin/mkcatalog/astmkcatalog.conf
@@ -12,6 +12,8 @@
 #  $ info astmkcatalog                   # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/mkcatalog/ui.c b/bin/mkcatalog/ui.c
index 3f81fb5..6927a54 100644
--- a/bin/mkcatalog/ui.c
+++ b/bin/mkcatalog/ui.c
@@ -1061,7 +1061,7 @@ ui_preparations_read_inputs(struct mkcatalogparams *p)
              pixels and 0 for zero pixels. */
           zero=gal_data_alloc(NULL, GAL_TYPE_UINT8, 1, &one, NULL, 1, -1,
                               NULL, NULL, NULL);
-          p->upmask=gal_arithmetic(GAL_ARITHMETIC_OP_NE,
+          p->upmask=gal_arithmetic(GAL_ARITHMETIC_OP_NE, 1,
                                    ( GAL_ARITHMETIC_INPLACE
                                      | GAL_ARITHMETIC_FREE
                                      | GAL_ARITHMETIC_NUMOK ),
diff --git a/bin/mknoise/astmknoise.conf b/bin/mknoise/astmknoise.conf
index 96e011c..5748e2f 100644
--- a/bin/mknoise/astmknoise.conf
+++ b/bin/mknoise/astmknoise.conf
@@ -12,6 +12,8 @@
 #  $ info astmknoise                     # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/mkprof/astmkprof.conf b/bin/mkprof/astmkprof.conf
index b680412..53c05e8 100644
--- a/bin/mkprof/astmkprof.conf
+++ b/bin/mkprof/astmkprof.conf
@@ -12,6 +12,8 @@
 #  $ info astmkprof                      # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/mkprof/ui.c b/bin/mkprof/ui.c
index f3408b3..fccdc87 100644
--- a/bin/mkprof/ui.c
+++ b/bin/mkprof/ui.c
@@ -666,7 +666,7 @@ ui_read_cols_2d(struct mkprofparams *p)
     gal_checkset_allocate_copy("standard-input", &p->catname);
 
   /* Set the number of objects. */
-  p->num=cols->size;
+  p->num = cols ? cols->size : 0;
 
   /* Put each column's data in the respective internal array. */
   while(cols!=NULL)
@@ -841,7 +841,7 @@ ui_read_cols_2d(struct mkprofparams *p)
                 "the profile's pixels will have a value of zero and thus "
                 "they will not be identifiable from the zero-valued "
                 "background. If this behavior is intended, this warning "
-                "can be supressed with the `--quiet' (or `-q') option.\n");
+                "can be suppressed with the `--quiet' (or `-q') option.\n");
           break;
         }
 }
@@ -1481,7 +1481,6 @@ ui_prepare_canvas(struct mkprofparams *p)
     }
 
 
-
   /* When individual mode is requested, write the WCS structure to a header
      string to speed up the process: if we don't do it here, this process
      will be necessary on every individual profile's output. So it is much
@@ -1729,8 +1728,10 @@ ui_preparations(struct mkprofparams *p)
   else
     ui_prepare_canvas(p);
 
-  /* Read the (possible) RA/Dec inputs into X and Y for the builder.*/
-  if(p->wcs)
+  /* Read the (possible) RA/Dec inputs into X and Y for the builder.  NOTE:
+     It may happen that there are no input columns, in that case, just
+     ignore this step.*/
+  if(p->wcs && p->num)
     ui_finalize_coordinates(p);
 
   /* Prepare the random number generator. */
@@ -1883,6 +1884,7 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
mkprofparams *p)
   /* Read/allocate all the necessary starting arrays. */
   ui_preparations(p);
 
+
   /* Print introductory information. */
   ui_print_intro(p);
 }
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index cbb4596..edbadcc 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -12,6 +12,8 @@
 #  $ info astnoisechisel                 # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 66df6e6..a26270f 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -217,19 +217,6 @@ parse_opt(int key, char *arg, struct argp_state *state)
 /**************************************************************/
 /***************       Sanity Check         *******************/
 /**************************************************************/
-static void
-ui_ngb_check(size_t value, char *optionname)
-{
-  if(value!=4 && value!=8 && value!=6 && value!=18 && value!=26)
-    error(EXIT_FAILURE, 0, "%zu is not an acceptable value for "
-          "`--%s'. Acceptable values are 4 or 8 (for 2D inputs) and "
-          "6, 18, or 26 (for 3D inputs)", value, optionname);
-}
-
-
-
-
-
 /* Read and check ONLY the options. When arguments are involved, do the
    check in `ui_check_options_and_arguments'. */
 static void
@@ -243,13 +230,6 @@ ui_read_check_only_options(struct noisechiselparams *p)
           "and avoid convolution) it is mandatory to also specify a HDU "
           "for it");
 
-  /* A general check on the neighbor connectivity values. */
-  ui_ngb_check(p->holengb, "holengb");
-  ui_ngb_check(p->erodengb, "erodengb");
-  ui_ngb_check(p->openingngb, "openingngb");
-  ui_ngb_check(p->openingngb, "dopeningngb");
-  ui_ngb_check(p->pseudoconcomp, "pseudoconcomp");
-
   /* Make sure that the no-erode-quantile is not smaller or equal to
      qthresh. */
   if( p->noerodequant <= p->qthresh)
@@ -562,13 +542,40 @@ ui_prepare_tiles(struct noisechiselparams *p)
 
 
 
-/* Read the input image and check the dimensions and neighbors. */
+static void
+ui_ngb_check(size_t value, char *optionname, size_t ndim)
+{
+  switch(ndim)
+    {
+    case 2:
+      if(value!=4 && value!=8)
+        error(EXIT_FAILURE, 0, "%zu is not an acceptable value for "
+              "`--%s'. Acceptable values for 2D inputs are 4 or 8",
+              value, optionname);
+      break;
+    case 3:
+      if(value!=6 && value!=18 && value!=26)
+        error(EXIT_FAILURE, 0, "%zu is not an acceptable value for "
+              "`--%s'. Acceptable values for 3D inputs are 6, 18 or 26",
+              value, optionname);
+      break;
+    default:
+      error(EXIT_FAILURE, 0, "%s: a bug! Please contact us at %s to fix the "
+            "problem. Dimention value %zu is not recognized.", __func__,
+            PACKAGE_BUGREPORT, ndim);
+    }
+}
+
+
+
+
+
+/* Read the input image and do the basic checks */
 static void
 ui_preparations_read_input(struct noisechiselparams *p)
 {
   float *f;
-  size_t value;
-  char *option_name=NULL, *good_values=NULL;
+  size_t ndim;
 
   /* Read the input as a single precision floating point dataset. */
   p->input = gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu,
@@ -579,51 +586,13 @@ ui_preparations_read_input(struct noisechiselparams *p)
   if(p->input->name==NULL)
     gal_checkset_allocate_copy("INPUT", &p->input->name);
 
-  /* Check dimensionality and neighbors. */
-  switch(p->input->ndim)
-    {
-    case 2:
-      if(p->erodengb!=4 && p->erodengb!=8)
-        {
-          value=p->erodengb;
-          good_values="4 or 8";
-          option_name="erodengb";
-        }
-      else if(p->openingngb!=4 && p->openingngb!=8)
-        {
-          value=p->openingngb;
-          good_values="4 or 8";
-          option_name="openingngb";
-        }
-      break;
-
-    case 3:
-      if(p->erodengb!=6 && p->erodengb!=18 && p->erodengb!=26)
-        {
-          value=p->erodengb;
-          good_values="6, 18, or 26";
-          option_name="erodengb";
-        }
-      else if(p->openingngb!=6 && p->openingngb!=18 && p->openingngb!=26)
-        {
-          value=p->openingngb;
-          good_values="6, 18, or 26";
-          option_name="openingngb";
-        }
-      break;
-
-    default:
-      error(EXIT_FAILURE, 0, "%s (hdu %s) is a %zu-dimensional dataset "
-            "which is currently not supported", p->inputname, p->cp.hdu,
-            p->input->ndim);
-    }
-
-  /* Abort with an error message if necessary. */
-  if(option_name)
-    error(EXIT_FAILURE, 0, "%zu not acceptable for `--%s' for the "
-          "input %zu-dimensional dataset in `%s' (hdu %s). It must be %s "
-          "(specifying the type of connectivity)", value, option_name,
-          p->input->ndim, p->inputname, p->cp.hdu, good_values);
+  /* Check the values of dimention-related options. */
+  ndim=p->input->ndim;
+  ui_ngb_check(p->holengb, "holengb", ndim);
+  ui_ngb_check(p->erodengb, "erodengb", ndim);
+  ui_ngb_check(p->openingngb, "openingngb", ndim);
+  ui_ngb_check(p->dopeningngb, "dopeningngb", ndim);
+  ui_ngb_check(p->pseudoconcomp, "pseudoconcomp", ndim);
 
   /* A small check to see if the edges of the dataset aren't zero valued:
      they should be masked. */
diff --git a/bin/script/Makefile.am b/bin/script/Makefile.am
new file mode 100644
index 0000000..485c7fa
--- /dev/null
+++ b/bin/script/Makefile.am
@@ -0,0 +1,50 @@
+## Process this file with automake to produce Makefile.inx
+##
+## Original author:
+##     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+## Contributing author(s):
+## Copyright (C) 2019, Free Software Foundation, Inc.
+##
+## Gnuastro is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## Gnuastro is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+
+
+
+
+
+## List of programs (scripts in this directory) to install under the
+## `prefix/bin' directory (`bin_SCRIPTS'), files necessary to distribute
+## with the tarball (`EXTRA_DIST') and output files (to be cleaned with
+## `make clean).
+bin_SCRIPTS = astscript-sort-by-night
+
+EXTRA_DIST = sort-by-night.in
+
+CLEANFILES = $(bin_SCRIPTS)
+
+
+
+
+
+## Command to do basic substitutions (anything surrounded by an `@').
+do_subst = sed -e 's,[@]VERSION[@],$(VERSION),g' \
+               -e 's,[@]SCRIPT_NAME[@],$@,g'
+
+
+
+
+
+## Rules to build the scripts
+astscript-sort-by-night: sort-by-night.in Makefile
+       $(do_subst) < $(srcdir)/sort-by-night.in > $@
+       chmod +x $@
diff --git a/bin/script/sort-by-night.in b/bin/script/sort-by-night.in
new file mode 100644
index 0000000..31c4d26
--- /dev/null
+++ b/bin/script/sort-by-night.in
@@ -0,0 +1,303 @@
+#!/bin/bash
+
+# Separate input datasets into multiple nights, run with `--help', or see
+# description under `print_help' (below) for more.
+#
+# Original author:
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Contributing author(s):
+# Copyright (C) 2019, Free Software Foundation, Inc.
+#
+# Gnuastro is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# Gnuastro is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+
+
+# Exit the script in the case of failure
+set -e
+
+
+
+
+
+# Default option values (can be changed with options on the
+# command-line).
+hdu=1
+hour=9
+copy=0
+link=0
+quiet=0
+key=DATE
+prefix=./
+version=@VERSION@
+scriptname=@SCRIPT_NAME@
+
+
+
+
+
+# Output of `--usage' and `--help':
+print_usage() {
+    cat <<EOF
+$scriptname: run with '--help' for list of options
+EOF
+}
+
+print_help() {
+    cat <<EOF
+Usage: $scriptname [OPTION] FITS-files
+
+This script is part of GNU Astronomy Utilities $version.
+
+This script will look into a HDU/extension for a header keyword in the
+given FITS files and interpret the value as a date. The inputs will be
+separated by "night"s. It will then print a list of all the input files
+along with the following two columns: night number and file number in that
+night (sorted by time). With '--link' a symbolic link (one for each input)
+will be made with names including the night classifier. With '--copy'
+instead of a link, a copy of the inputs will be made.
+
+For more information, please run any of the following commands. In
+particular the first contains a very comprehensive explanation of this
+script's invocation: expected input(s), output(s), and a full description
+of all the options.
+
+     Inputs/Outputs and options:           $ info $scriptname
+     Full Gnuastro manual/book:            $ info gnuastro
+
+If you couldn't find your answer in the manual, you can get direct help from
+experienced Gnuastro users and developers. For more information, please run:
+
+     $ info help-gnuastro
+
+$scriptname options:
+ Input:
+  -h, --hdu=STR           HDU/extension of all input FITS files.
+  -k, --key=STR           Header keyword specifying date to use.
+  -H, --hour=FLT          Hour in next day to be included in night.
+
+ Output:
+  -l, --link              list of inputs with night and file number.
+  -c, --copy              Copy the files, don't make symbolic links.
+  -p, --prefix=STR        Prefix for outputs of '--copy' and '--link'.
+
+ Operating mode:
+  -h, --help              Print this help list.
+      --cite              BibTeX citation for this program.
+  -q, --quiet             Don't print the list.
+  -V, --version           Print program version.
+
+Mandatory or optional arguments to long options are also mandatory or optional
+for any corresponding short options.
+
+GNU Astronomy Utilities home page: http://www.gnu.org/software/gnuastro/
+
+Report bugs to bug-gnuastro@gnu.org.
+EOF
+}
+
+
+
+
+
+# Output of `--version':
+print_version() {
+    cat <<EOF
+$scriptname (GNU Astronomy Utilities) $version
+Copyright (C) 2015-2019, Free Software Foundation, Inc.
+License GPLv3+: GNU General public license version 3 or later.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written/developed by Mohammad Akhlaghi
+EOF
+}
+
+
+
+
+
+# Functions to check option values and complain if necessary.
+function on_off_option_error() {
+    if [ "x$2" = x ]; then
+        echo "$scriptname: '$1' doesn't take any values."
+    else
+        echo "$scriptname: '$1' (or '$2') doesn't take any values."
+    fi
+    exit 1
+}
+
+function check_v() {
+    if [ x"$2" = x ]; then
+        echo "$scriptname: option '$1' requires an argument."
+        echo "Try '$scriptname --help' for more information."
+        exit 1;
+    fi
+}
+
+
+
+
+
+# Separate command-line arguments from options. Then put the option
+# value into the respective variable.
+#
+# OPTIONS WITH A VALUE:
+#
+#   Each option has three lines because we want to all common formats: for
+#   long option names: `--longname value' and `--longname=value'. For short
+#   option names we want `-l value', `-l=value' and `-lvalue' (where `-l'
+#   is the short version of the hypothetical `--longname' option).
+#
+#   The first case (with a space between the name and value) is two
+#   command-line arguments. So, we'll need to shift it two times. The
+#   latter two cases are a single command-line argument, so we just need to
+#   "shift" the counter by one. IMPORTANT NOTE: the ORDER OF THE LATTER TWO
+#   cases matters: `-h*' should be checked only when we are sure that its
+#   not `-h=*').
+#
+# OPTIONS WITH NO VALUE (ON-OFF OPTIONS)
+#
+#   For these, we just want the two forms of `--longname' or `-l'. Nothing
+#   else. So if an equal sign is given we should definitely crash and also,
+#   if a value is appended to the short format it should crash. So in the
+#   second test for these (`-l*') will account for both the case where we
+#   have an equal sign and where we don't.
+while [[ $# -gt 0 ]]
+do
+    case "$1" in
+        # Input parameters.
+        -h|--hdu)         hdu="$2";                           check_v "$1" 
"$hdu";  shift;shift;;
+        -h=*|--hdu=*)     hdu="${1#*=}";                      check_v "$1" 
"$hdu";  shift;;
+        -h*)              hdu=$(echo "$1"  | sed -e's/-h//'); check_v "$1" 
"$hdu";  shift;;
+        -k|--key)         key="$2";                           check_v "$1" 
"$key";  shift;shift;;
+        -k=*|--key=*)     key="${1#*=}";                      check_v "$1" 
"$key";  shift;;
+        -k*)              key=$(echo "$1"  | sed -e's/-k//'); check_v "$1" 
"$key";  shift;;
+        -H|--hour)        hour="$2";                          check_v "$1" 
"$hour"; shift;shift;;
+        -H=*|--hour=*)    hour="${1#*=}";                     check_v "$1" 
"$hour"; shift;;
+        -H*)              hour=$(echo "$1" | sed -e's/-H//'); check_v "$1" 
"$hour"; shift;;
+
+        # Output parameters
+        -l|--link)        link=1; shift;;
+        -l*|--link=*)     on_off_option_error --link -l;;
+        -c|--copy)        copy=1; shift;;
+        -c*|--copy=*)     on_off_option_error --copy -c;;
+        -p|--prefix)      prefix="$2";                          check_v "$1" 
"$prefix"; shift;shift;;
+        -p=*|--prefix=*)  prefix="${1#*=}";                     check_v "$1" 
"$prefix"; shift;;
+        -p*)              prefix=$(echo "$1" | sed -e's/-p//'); check_v "$1" 
"$prefix"; shift;;
+
+        # Non-operating options.
+        -q|--quiet)       quiet=1; shift;;
+        -q*|--quiet=*)    on_off_option_error --quiet -q;;
+        -?|--help)        print_help; exit 0;;
+        -'?'*|--help=*)   on_off_option_error --help -?;;
+        -V|--version)     print_version; exit 0;;
+        -V*|--version=*)  on_off_option_error --version -V;;
+        --cite)           astfits --cite; exit 0;;
+        --cite=*)         on_off_option_error --cite;;
+
+        # Unrecognized option:
+        -*) echo "$scriptname: unknown option '$1'"; exit 1;;
+
+        # Not an option (not starting with a `-'): assumed to be input FITS
+        # file name.
+        *) inputs="$1 $inputs"; shift;;
+    esac
+done
+
+
+
+
+
+# Basic sanity checks on arguments.
+if [ x"$inputs" = x ]; then
+    echo "$scriptname: no input FITS files."
+    echo "Run with '--help' for more information on how to run."
+    exit 1
+fi
+
+if [ $copy = 1 ] && [ $link = 1 ]; then
+    echo "$scriptname: '--copy' and '--link' cannot be called together"
+    exit 1
+fi
+
+
+
+
+
+# Find the night number (including until 9:00 a.m of the following
+# day) of each image.
+#
+# To do this, we'll convert the date into Unix epoch time (seconds
+# since 1970-01-01,00:00:00) and keep that with the filename.
+list=$(for f in $inputs; do
+           astfits $f --datetosec=$key --hdu=$hdu -q \
+               | awk '{h='$hour'; d=int($1/86400);   \
+                       print "'$f'", $1,             \
+                       int($1)%86400<(h*3600) ? d-1 : d }';
+       done)
+
+
+
+
+# To see the result of the step above, uncomment the next line. You
+# can use a similar line to inspect the steps for later variables also
+# (just changing the variable name). IMPORTANT NOTE: Just don't forget
+# the double-quotes around the variable name, otherwise the lines
+# won't be separated.
+#echo "$list"; exit 1
+
+
+
+
+
+# Get the uniqe nights from the previous step.
+unique=$(echo "$list" | awk '{print $3}' | sort | uniq | cat -n)
+
+
+
+
+
+# Find the FITS files of every unique day and sort them by observing
+# time within that day. We'll also initialize the night-counter to 1.
+counter=1
+echo "$unique" | while read l; do
+
+    # Find all input files (and their Unix epoch time).
+    daynum_to=$(echo $l | awk '{print $1}')
+    daynum_from=$(echo $l | awk '{print $2}')
+    in_this_day=$(echo "$list" \
+                       | awk '$3=='$daynum_from' {print $1, $2}' \
+                       | sort -nk2 \
+                       | cat -n \
+                       | awk '{print $2,'$counter',$1}')
+
+    # Now that we know this night's files, we can take the proper action.
+    echo "$in_this_day" | while read L; do
+
+        # Set the necessary numbers.
+        infile=$(echo $L | awk '{print $1}')
+        night_num=$(echo $L | awk '{print $2}')
+        exposure_num=$(echo $L | awk '{print $3}')
+
+        # Make the outputs
+        outfile=$prefix"n"$night_num-$exposure_num.fits
+        if   [ $copy = 1 ]; then   cp $infile $outfile
+        elif [ $link = 1 ]; then   ln -fs $infile $outfile
+        else                       echo "$infile $night_num $exposure_num"
+        fi
+
+    done
+
+    # Increment the night-counter.
+    ((counter++))
+done
diff --git a/bin/segment/astsegment.conf b/bin/segment/astsegment.conf
index dbbc038..caf71bb 100644
--- a/bin/segment/astsegment.conf
+++ b/bin/segment/astsegment.conf
@@ -12,6 +12,8 @@
 #  $ info astsegment                     # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/segment/ui.c b/bin/segment/ui.c
index 0867674..e8bb046 100644
--- a/bin/segment/ui.c
+++ b/bin/segment/ui.c
@@ -127,6 +127,10 @@ ui_initialize_options(struct segmentparams *p,
       /* Select individually. */
       switch(cp->coptions[i].key)
         {
+        case GAL_OPTIONS_KEY_HDU:
+          cp->coptions[i].doc="HDU containing values (science image).";
+          break;
+
         case GAL_OPTIONS_KEY_LOG:
         case GAL_OPTIONS_KEY_TYPE:
         case GAL_OPTIONS_KEY_SEARCHIN:
diff --git a/bin/statistics/aststatistics.conf 
b/bin/statistics/aststatistics.conf
index 0bf3b83..8257fef 100644
--- a/bin/statistics/aststatistics.conf
+++ b/bin/statistics/aststatistics.conf
@@ -12,6 +12,8 @@
 #  $ info aststatistics                  # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/statistics/ui.c b/bin/statistics/ui.c
index 4e1c7d4..662c0df 100644
--- a/bin/statistics/ui.c
+++ b/bin/statistics/ui.c
@@ -597,7 +597,7 @@ ui_out_of_range_to_blank(struct statisticsparams *p)
       tmp=gal_data_alloc(NULL, GAL_TYPE_FLOAT32, 1, &one, NULL, 0, -1,
                         NULL, NULL, NULL);
       *((float *)(tmp->array)) = p->greaterequal;
-      cond_g=gal_arithmetic(GAL_ARITHMETIC_OP_LT, flags, ref, tmp);
+      cond_g=gal_arithmetic(GAL_ARITHMETIC_OP_LT, 1, flags, ref, tmp);
       gal_data_free(tmp);
     }
 
@@ -608,7 +608,7 @@ ui_out_of_range_to_blank(struct statisticsparams *p)
       tmp=gal_data_alloc(NULL, GAL_TYPE_FLOAT32, 1, &one, NULL, 0, -1,
                         NULL, NULL, NULL);
       *((float *)(tmp->array)) = p->lessthan;
-      cond_l=gal_arithmetic(GAL_ARITHMETIC_OP_GE, flags, ref, tmp);
+      cond_l=gal_arithmetic(GAL_ARITHMETIC_OP_GE, 1, flags, ref, tmp);
       gal_data_free(tmp);
     }
 
@@ -622,7 +622,7 @@ ui_out_of_range_to_blank(struct statisticsparams *p)
       cond = isnan(p->greaterequal) ? cond_l : cond_g;
       break;
     case 2:
-      cond = gal_arithmetic(GAL_ARITHMETIC_OP_OR, flagsor, cond_l, cond_g);
+      cond = gal_arithmetic(GAL_ARITHMETIC_OP_OR, 1, flagsor, cond_l, cond_g);
       break;
     }
 
@@ -637,7 +637,7 @@ ui_out_of_range_to_blank(struct statisticsparams *p)
   /* Set all the pixels that satisfy the condition to blank. Note that a
      blank value will be used in the proper type of the input in the
      `where' operator.*/
-  gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, flagsor, p->input, cond, blank);
+  gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, 1, flagsor, p->input, cond, blank);
 
 
   /* Reset the blank flags so they are checked again if necessary. */
diff --git a/bin/table/args.h b/bin/table/args.h
index afb9bde..4c151d1 100644
--- a/bin/table/args.h
+++ b/bin/table/args.h
@@ -76,6 +76,46 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
+    {
+      "range",
+      UI_KEY_RANGE,
+      "STR,FLT:FLT",
+      0,
+      "Column, and range to limit output.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->range,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET,
+      gal_options_parse_name_and_values
+    },
+    {
+      "sort",
+      UI_KEY_SORT,
+      "STR,INT",
+      0,
+      "Column name or number for sorting.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->sort,
+      GAL_TYPE_STRING,
+      GAL_OPTIONS_RANGE_ANY,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
+      "descending",
+      UI_KEY_DESCENDING,
+      0,
+      0,
+      "Sort in descending order: largets first.",
+      GAL_OPTIONS_GROUP_OUTPUT,
+      &p->descending,
+      GAL_OPTIONS_NO_ARG_TYPE,
+      GAL_OPTIONS_RANGE_0_OR_1,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
 
 
 
diff --git a/bin/table/asttable.conf b/bin/table/asttable.conf
index fc88f34..a7a1a97 100644
--- a/bin/table/asttable.conf
+++ b/bin/table/asttable.conf
@@ -12,6 +12,8 @@
 #  $ info asttable                       # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/table/main.h b/bin/table/main.h
index bc9af45..f3e4bb7 100644
--- a/bin/table/main.h
+++ b/bin/table/main.h
@@ -37,6 +37,14 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 
+struct list_range
+{
+  gal_data_t           *v;
+  struct list_range *next;
+};
+
+
+
 
 
 /* Main program parameters structure */
@@ -48,10 +56,18 @@ struct tableparams
   gal_list_str_t     *columns;  /* List of given columns.               */
   uint8_t         information;  /* ==1: only print FITS information.    */
   uint8_t     colinfoinstdout;  /* ==1: print column metadata in CL.    */
+  gal_data_t           *range;  /* Range to limit output.               */
+  char                  *sort;  /* Column name or number for sorting.   */
+  uint8_t          descending;  /* Sort columns in descending order.    */
 
-  /* Output: */
+  /* Internal. */
   gal_data_t           *table;  /* Linked list of output table columns. */
   gal_data_t      *allcolinfo;  /* Information of all the columns.      */
+  gal_data_t         *sortcol;  /* Column to define a sorting.          */
+  struct list_range *rangecol;  /* Column to define a range.            */
+  uint8_t            freesort;  /* If the sort column should be freed.  */
+  uint8_t          *freerange;  /* If the range column should be freed. */
+  uint8_t              sortin;  /* If the sort column is in the output. */
   time_t              rawtime;  /* Starting time of the program.        */
 };
 
diff --git a/bin/table/table.c b/bin/table/table.c
index 2c9b54c..7577064 100644
--- a/bin/table/table.c
+++ b/bin/table/table.c
@@ -29,12 +29,239 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <stdlib.h>
 #include <unistd.h>
 
+#include <gsl/gsl_heapsort.h>
+
 #include <gnuastro/fits.h>
 #include <gnuastro/table.h>
+#include <gnuastro/qsort.h>
+#include <gnuastro/arithmetic.h>
+#include <gnuastro/statistics.h>
+#include <gnuastro/permutation.h>
 
 #include <gnuastro-internal/checkset.h>
 
 #include "main.h"
+#include "ui.h"
+
+
+
+/**************************************************************/
+/********     Selecting and ordering of columns      **********/
+/**************************************************************/
+static void
+table_apply_permutation(gal_data_t *table, size_t *permutation,
+                        size_t newsize, int inverse)
+{
+  gal_data_t *tmp;
+
+  for(tmp=table;tmp!=NULL;tmp=tmp->next)
+    {
+      /* Apply the permutation. */
+      if(inverse)
+        gal_permutation_apply_inverse(tmp, permutation);
+      else
+        gal_permutation_apply(tmp, permutation);
+
+      /* Correct the size. */
+      tmp->size=tmp->dsize[0]=newsize;
+    }
+}
+
+
+
+
+
+static void
+table_range(struct tableparams *p)
+{
+  uint8_t *u;
+  double *rarr;
+  gal_data_t *mask;
+  struct list_range *tmp;
+  gal_data_t *ref, *perm, *range;
+  size_t i, g, b, *s, *sf, one=1, ngood=0;
+  gal_data_t *min, *max, *ltmin, *gemax, *sum;
+
+  int numok=GAL_ARITHMETIC_NUMOK;
+  int inplace=GAL_ARITHMETIC_INPLACE;
+
+  /* Allocate datasets for the necessary numbers and write them in. */
+  min=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &one, NULL, 0, -1,
+                     NULL, NULL, NULL);
+  max=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &one, NULL, 0, -1,
+                     NULL, NULL, NULL);
+  perm=gal_data_alloc(NULL, GAL_TYPE_SIZE_T, 1, p->table->dsize, NULL, 0,
+                      p->cp.minmapsize, NULL, NULL, NULL);
+  mask=gal_data_alloc(NULL, GAL_TYPE_UINT8, 1, p->table->dsize, NULL, 1,
+                      p->cp.minmapsize, NULL, NULL, NULL);
+
+  /* Go over all the necessary range options. */
+  range=p->range;
+  for(tmp=p->rangecol;tmp!=NULL;tmp=tmp->next)
+    {
+      /* Set the minimum and maximum values. */
+      rarr=range->array;
+      ((double *)(min->array))[0] = rarr[0];
+      ((double *)(max->array))[0] = rarr[1];
+
+      /* Set the reference column to read values from. */
+      ref=tmp->v;
+
+      /* Find all the bad elements (smaller than the minimum and larger than
+         the maximum) so we can flag them. */
+      ltmin=gal_arithmetic(GAL_ARITHMETIC_OP_LT, 1, numok,   ref,   min);
+      gemax=gal_arithmetic(GAL_ARITHMETIC_OP_GE, 1, numok,   ref,   max);
+      ltmin=gal_arithmetic(GAL_ARITHMETIC_OP_OR, 1, inplace, ltmin, gemax);
+
+      /* Add these flags to all previous flags. */
+      mask=gal_arithmetic(GAL_ARITHMETIC_OP_OR, 1, inplace, mask, ltmin);
+
+      /* For a check.
+      {
+        float *f=ref->array;
+        uint8_t *m=mask->array;
+        uint8_t *u=ltmin->array, *uf=u+ltmin->size;
+        printf("\n\nInput column: %s\n", ref->name ? ref->name : "No Name");
+        printf("Range: %g, %g\n", rarr[0], rarr[1]);
+        printf("%-20s%-20s%-20s\n", "Value", "This mask",
+               "Including previous");
+        do printf("%-20f%-20u%-20u\n", *f++, *u++, *m++); while(u<uf);
+        exit(0);
+      }
+      */
+
+      /* Clean up. */
+      gal_data_free(ltmin);
+      gal_data_free(gemax);
+
+      /* Increment pointers. */
+      range=range->next;
+    }
+
+  /* Count the number of bad elements. */
+  sum=gal_statistics_sum(mask);
+  ngood = p->table->size - ((double *)(sum->array))[0];
+
+  /* Define the permutation: elements within range remain on the top of
+     the list, while the ones outside of will be placed after them
+     (starting from the index after the last good one). */
+  g=0;          /* Good indexs (starting from 0). */
+  b=ngood;      /* Bad indexs (starting from total number of good). */
+  u=mask->array;
+  sf=(s=perm->array)+perm->size;
+  do *s = *u++ ? b++ : g++; while(++s<sf);
+
+  /* For a check
+  {
+    size_t i;
+    double *v=ref->array;
+    uint8_t *a=mask->array;
+    printf("ref->type: %s\n", gal_type_name(ref->type, 1));
+    for(i=0;i<ref->size;++i) printf("%u, %g\n", a[i], v[i]);
+    gal_permutation_check(perm->array, perm->size);
+  }
+  */
+
+  /* Apply the final permutation to the whole table. */
+  table_apply_permutation(p->table, perm->array, ngood, 1);
+
+  /* If the sort column is not in the table (the proper range has already
+     been applied to it), and we need to sort the resulting columns
+     afterwards, we should also apply the permutation on the sort
+     column. */
+  if(p->sortcol && p->sortin==0)
+    table_apply_permutation(p->sortcol, perm->array, ngood, 1);
+
+  /* Clean up. */
+  i=0;
+  for(tmp=p->rangecol;tmp!=NULL;tmp=tmp->next)
+    { if(p->freerange[i]) {gal_data_free(tmp->v); tmp->v=NULL;} ++i; }
+  ui_list_range_free(p->rangecol, 0);
+  gal_data_free(mask);
+  gal_data_free(perm);
+  gal_data_free(sum);
+  gal_data_free(min);
+  gal_data_free(max);
+  free(p->freerange);
+}
+
+
+
+
+
+static void
+table_sort(struct tableparams *p)
+{
+  gal_data_t *perm;
+  size_t c=0, *s, *sf;
+  int (*qsortfn)(const void *, const void *)=NULL;
+
+  /* In case there are no columns to sort, skip this function. */
+  if(p->table->size==0) return;
+
+  /* Allocate the permutation array and fill it. */
+  perm=gal_data_alloc(NULL, GAL_TYPE_SIZE_T, 1, p->table->dsize, NULL, 0,
+                      p->cp.minmapsize, NULL, NULL, NULL);
+  sf=(s=perm->array)+perm->size; do *s=c++; while(++s<sf);
+
+  /* Set the proper qsort function. */
+  if(p->descending)
+    switch(p->sortcol->type)
+      {
+      case GAL_TYPE_UINT8:   qsortfn=gal_qsort_index_single_uint8_d;   break;
+      case GAL_TYPE_INT8:    qsortfn=gal_qsort_index_single_int8_d;    break;
+      case GAL_TYPE_UINT16:  qsortfn=gal_qsort_index_single_uint16_d;  break;
+      case GAL_TYPE_INT16:   qsortfn=gal_qsort_index_single_int16_d;   break;
+      case GAL_TYPE_UINT32:  qsortfn=gal_qsort_index_single_uint32_d;  break;
+      case GAL_TYPE_INT32:   qsortfn=gal_qsort_index_single_int32_d;   break;
+      case GAL_TYPE_UINT64:  qsortfn=gal_qsort_index_single_uint64_d;  break;
+      case GAL_TYPE_INT64:   qsortfn=gal_qsort_index_single_int64_d;   break;
+      case GAL_TYPE_FLOAT32: qsortfn=gal_qsort_index_single_float32_d; break;
+      case GAL_TYPE_FLOAT64: qsortfn=gal_qsort_index_single_float64_d; break;
+      default:
+        error(EXIT_FAILURE, 0, "%s: a bug! Please contact us at %s to fix "
+              "the problem. The code `%u' wasn't recognized as a data type",
+              __func__, PACKAGE_BUGREPORT, p->sortcol->type);
+      }
+  else
+    switch(p->sortcol->type)
+      {
+      case GAL_TYPE_UINT8:   qsortfn=gal_qsort_index_single_uint8_i;   break;
+      case GAL_TYPE_INT8:    qsortfn=gal_qsort_index_single_int8_i;    break;
+      case GAL_TYPE_UINT16:  qsortfn=gal_qsort_index_single_uint16_i;  break;
+      case GAL_TYPE_INT16:   qsortfn=gal_qsort_index_single_int16_i;   break;
+      case GAL_TYPE_UINT32:  qsortfn=gal_qsort_index_single_uint32_i;  break;
+      case GAL_TYPE_INT32:   qsortfn=gal_qsort_index_single_int32_i;   break;
+      case GAL_TYPE_UINT64:  qsortfn=gal_qsort_index_single_uint64_i;  break;
+      case GAL_TYPE_INT64:   qsortfn=gal_qsort_index_single_int64_i;   break;
+      case GAL_TYPE_FLOAT32: qsortfn=gal_qsort_index_single_float32_i; break;
+      case GAL_TYPE_FLOAT64: qsortfn=gal_qsort_index_single_float64_i; break;
+      default:
+        error(EXIT_FAILURE, 0, "%s: a bug! Please contact us at %s to fix "
+              "the problem. The code `%u' wasn't recognized as a data type",
+              __func__, PACKAGE_BUGREPORT, p->sortcol->type);
+      }
+
+  /* Sort the indexs from the values. */
+  gal_qsort_index_single=p->sortcol->array;
+  qsort(perm->array, perm->size, sizeof *s, qsortfn);
+
+  /* For a check (only on float32 type `sortcol'):
+  {
+    float *f=p->sortcol->array;
+    sf=(s=perm->array)+perm->size;
+    do printf("%f\n", f[*s]); while(++s<sf);
+    exit(0);
+  }
+  */
+
+  /* Sort all the output columns with this permutation. */
+  table_apply_permutation(p->table, perm->array, perm->size, 0);
+
+  /* Clean up. */
+  gal_data_free(perm);
+  if(p->freesort) gal_data_free(p->sortcol);
+}
 
 
 
@@ -46,7 +273,13 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 void
 table(struct tableparams *p)
 {
-  gal_checkset_writable_remove(p->cp.output, 0, p->cp.dontdelete);
+  /* Apply a certain range (if required) to the output sample. */
+  if(p->range) table_range(p);
+
+  /* Sort it (if required). */
+  if(p->sort) table_sort(p);
+
+  /* Write the output. */
   gal_table_write(p->table, NULL, p->cp.tableformat, p->cp.output,
                   "TABLE", p->colinfoinstdout);
 }
diff --git a/bin/table/ui.c b/bin/table/ui.c
index ddac7e4..3431f76 100644
--- a/bin/table/ui.c
+++ b/bin/table/ui.c
@@ -26,9 +26,11 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <errno.h>
 #include <error.h>
 #include <stdio.h>
+#include <string.h>
 
 #include <gnuastro/fits.h>
 #include <gnuastro/table.h>
+#include <gnuastro/pointer.h>
 
 #include <gnuastro-internal/timing.h>
 #include <gnuastro-internal/options.h>
@@ -113,7 +115,6 @@ ui_initialize_options(struct tableparams *p,
   cp->program_authors    = PROGRAM_AUTHORS;
   cp->coptions           = gal_commonopts_options;
 
-
   /* Modify common options. */
   for(i=0; !gal_options_is_last(&cp->coptions[i]); ++i)
     {
@@ -217,11 +218,28 @@ parse_opt(int key, char *arg, struct argp_state *state)
 static void
 ui_read_check_only_options(struct tableparams *p)
 {
+  double *darr;
+  gal_data_t *tmp;
 
   /* Check if the format of the output table is valid, given the type of
      the output. */
   gal_tableintern_check_fits_format(p->cp.output, p->cp.tableformat);
 
+  /* Some checks on `--range'. */
+  if(p->range)
+    for(tmp=p->range;tmp!=NULL;tmp=tmp->next)
+      {
+        /* Range needs two input numbers. */
+        if(tmp->size!=2)
+          error(EXIT_FAILURE, 0, "two values (separated by comma) necessary "
+                "for `--range' in this format: `--range=COLUMN,min,max'");
+
+        /* The first must be smaller than the second. */
+        darr=tmp->array;
+        if( darr[0] > darr[1] )
+          error(EXIT_FAILURE, 0, "first value (%g) given to `--range' must "
+                "be smaller than the second (%g)", darr[0], darr[1]);
+      }
 }
 
 
@@ -261,6 +279,98 @@ ui_check_options_and_arguments(struct tableparams *p)
 
 
 
+/**************************************************************/
+/***************   List of range datasets   *******************/
+/**************************************************************/
+static void
+ui_list_range_add(struct list_range **list, gal_data_t *dataset)
+{
+  struct list_range *newnode;
+
+  errno=0;
+  newnode=malloc(sizeof *newnode);
+  if(newnode==NULL)
+    error(EXIT_FAILURE, errno, "%s: allocating new node", __func__);
+
+  newnode->v=dataset;
+  newnode->next=*list;
+  *list=newnode;
+}
+
+
+
+
+
+static gal_data_t *
+ui_list_range_pop(struct list_range **list)
+{
+  gal_data_t *out=NULL;
+  struct list_range *tmp;
+  if(*list)
+    {
+      tmp=*list;
+      out=tmp->v;
+      *list=tmp->next;
+      free(tmp);
+    }
+  return out;
+}
+
+
+
+
+
+static void
+ui_list_range_reverse(struct list_range **list)
+{
+  gal_data_t *thisdata;
+  struct list_range *correctorder=NULL;
+
+  /* Only do the reversal if there is more than one element. */
+  if( *list && (*list)->next )
+    {
+      while(*list!=NULL)
+        {
+          thisdata=ui_list_range_pop(list);
+          ui_list_range_add(&correctorder, thisdata);
+        }
+      *list=correctorder;
+    }
+}
+
+
+
+
+
+void
+ui_list_range_free(struct list_range *list, int freevalue)
+{
+  struct list_range *tmp;
+  while(list!=NULL)
+    {
+      tmp=list->next;
+      if(freevalue)
+        gal_data_free(list->v);
+      free(list);
+      list=tmp;
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 /**************************************************************/
@@ -273,7 +383,7 @@ ui_print_info_exit(struct tableparams *p)
   int tableformat;
   gal_data_t *allcols;
   gal_list_str_t *lines;
-  size_t i, numcols, numrows;
+  size_t numcols, numrows;
 
   /* Read the table information for the number of columns and rows. */
   lines=gal_options_check_stdin(p->filename, p->cp.stdintimeout, "input");
@@ -299,9 +409,7 @@ ui_print_info_exit(struct tableparams *p)
 
 
   /* Free the information from all the columns. */
-  for(i=0;i<numcols;++i)
-    gal_data_free_contents(&allcols[i]);
-  free(allcols);
+  gal_data_array_free(allcols, numcols, 0);
 
 
   /* Free the allocated spaces and exit. Otherwise, add the number of
@@ -359,38 +467,357 @@ ui_columns_prepare(struct tableparams *p)
 
 
 
+/* The users give column numbers counting from 1. But we need an `index'
+   (starting from 0). So if we can read it as a number, we'll subtract one
+   from it. */
+static size_t
+ui_check_range_sort_read_col_ind(char *string)
+{
+  size_t out;
+  void *ptr=&out;
+
+  if( gal_type_from_string(&ptr, string, GAL_TYPE_SIZE_T) )
+    out=GAL_BLANK_SIZE_T;
+  else out-=1;
+
+  return out;
+}
+
+
+
+
+
+/* See if the `--range' and `--sort' columns should also be added. */
+static void
+ui_check_range_sort_before(struct tableparams *p, gal_list_str_t *lines,
+                           size_t *nrange, size_t *origoutncols,
+                           size_t *sortindout, size_t **rangeindout_out)
+{
+  size_t *rangeind=NULL;
+  size_t *rangeindout=NULL;
+  gal_data_t *dtmp, *allcols;
+  size_t sortind=GAL_BLANK_SIZE_T;
+  int tableformat, rangehasname=0;
+  gal_list_sizet_t *tmp, *indexll;
+  gal_list_str_t *stmp, *add=NULL;
+  size_t i, j, *s, *sf, allncols, numcols, numrows;
+
+
+  /* Allocate necessary spaces. */
+  if(p->range)
+    {
+      *nrange=gal_list_data_number(p->range);
+      rangeind=gal_pointer_allocate(GAL_TYPE_SIZE_T, *nrange, 0,
+                                    __func__, "rangeind");
+      rangeindout=gal_pointer_allocate(GAL_TYPE_SIZE_T, *nrange, 0,
+                                        __func__, "rangeindout");
+      sf=(s=rangeindout)+*nrange; do *s++=GAL_BLANK_SIZE_T; while(s<sf);
+      *rangeindout_out=rangeindout;
+    }
+
+
+  /* See if the given columns are numbers or names. */
+  i=0;
+  if(p->sort)  sortind  = ui_check_range_sort_read_col_ind(p->sort);
+  if(p->range)
+    for(dtmp=p->range;dtmp!=NULL;dtmp=dtmp->next)
+      {
+        rangeind[i] = ui_check_range_sort_read_col_ind(dtmp->name);
+        ++i;
+      }
+
+
+  /* Get all the column information. */
+  allcols=gal_table_info(p->filename, p->cp.hdu, lines, &numcols,
+                         &numrows, &tableformat);
+
+
+  /* If the values are numbers, we'll check if the given value is less than
+     the total number of columns. Just note that the indexs count from
+     zero. */
+  if(p->sort && sortind!=GAL_BLANK_SIZE_T && sortind>=numcols)
+    error(EXIT_FAILURE, 0, "%s has %zu columns, less than the column "
+          "number given to  `--sort' (%s)",
+          gal_fits_name_save_as_string(p->filename, p->cp.hdu), numcols,
+          p->sort);
+  if(p->range)
+    for(i=0;i<*nrange;++i)
+      if(rangeind[i]!=GAL_BLANK_SIZE_T && rangeind[i]>=numcols)
+        error(EXIT_FAILURE, 0, "%s has %zu columns, less than the column "
+              "number given to  `--range' (%zu)",
+              gal_fits_name_save_as_string(p->filename, p->cp.hdu), numcols,
+              rangeind[i]);
+
+
+  /* If any of the columns isn't specified by an index, go over the table
+     information and set the index based on the names. */
+  if(p->range)
+    for(i=0;i<*nrange;++i)
+      if(rangeind[i]==GAL_BLANK_SIZE_T) { rangehasname=1; break; }
+  if( (p->sort && sortind==GAL_BLANK_SIZE_T) || rangehasname )
+    {
+      /* For `--sort', go over all the columns if an index hasn't been set
+         yet. If the input columns have a name, see if their names matches
+         the name given to `sort'. */
+      if(p->sort && sortind==GAL_BLANK_SIZE_T)
+        for(i=0;i<numcols;++i)
+          if( allcols[i].name && !strcasecmp(allcols[i].name, p->sort) )
+            { sortind=i; break; }
+
+      /* Same for `--range'. Just note that here we may have multiple calls
+         to `--range'. It is thus important to loop over the values given
+         to range first, then loop over the column names from the start for
+         each new `--ran */
+      i=0;
+      if(p->range)
+        for(dtmp=p->range;dtmp!=NULL;dtmp=dtmp->next)
+          {
+           if(rangeind[i]==GAL_BLANK_SIZE_T)
+             for(j=0;j<numcols;++j)
+               if( allcols[j].name
+                   && !strcasecmp(allcols[j].name, dtmp->name) )
+                 { rangeind[i]=j; break; }
+           ++i;
+          }
+    }
+
+
+  /* Both columns must be good indexs now, if they aren't the user didn't
+     specify the name properly and the program must abort. */
+  if( p->sort && sortind==GAL_BLANK_SIZE_T )
+    error(EXIT_FAILURE, 0, "%s: no column named `%s' (value to `--sort') "
+          "you can either specify a name or number",
+          gal_fits_name_save_as_string(p->filename, p->cp.hdu), p->sort);
+  if(p->range)
+    {
+      i=0;
+      for(dtmp=p->range;dtmp!=NULL;dtmp=dtmp->next)
+        {
+          if(rangeind[i]==GAL_BLANK_SIZE_T)
+            error(EXIT_FAILURE, 0, "%s: no column named `%s' (value to "
+                  "`--range') you can either specify a name or number",
+                  gal_fits_name_save_as_string(p->filename, p->cp.hdu),
+                  dtmp->name);
+          ++i;
+        }
+    }
+
+
+  /* See which columns the user has asked for. */
+  indexll=gal_table_list_of_indexs(p->columns, allcols, numcols,
+                                   p->cp.searchin, p->cp.ignorecase,
+                                   p->filename, p->cp.hdu, NULL);
+  allncols=*origoutncols=gal_list_sizet_number(indexll);
+
+
+  /* See if the requested columns are already on the to-read list. If so,
+     keep the counter. */
+  i=0;
+  for(tmp=indexll; tmp!=NULL; tmp=tmp->next)
+    {
+      if(p->sort  && *sortindout==GAL_BLANK_SIZE_T  && tmp->v == sortind)
+        *sortindout=i;
+      if(p->range)
+        for(j=0;j<*nrange;++j)
+          if(rangeindout[j]==GAL_BLANK_SIZE_T && tmp->v==rangeind[j])
+            rangeindout[j]=i;
+      ++i;
+    }
+
+
+  /* See if any of the necessary columns (for `--sort' and `--range')
+     aren't requested as an output by the user. If there is any, such
+     columns, keep them here. */
+  if( p->sort && *sortindout==GAL_BLANK_SIZE_T )
+    { *sortindout=allncols++;  gal_list_str_add(&add, p->sort, 0); }
+
+
+  /* Note that the sorting and range may be requested on the same
+     column. In this case, we don't want to read the same column twice. */
+  if(p->range)
+    {
+      i=0;
+      for(dtmp=p->range;dtmp!=NULL;dtmp=dtmp->next)
+        {
+          if(*sortindout!=GAL_BLANK_SIZE_T
+             && rangeindout[i]==*sortindout)
+            rangeindout[i]=*sortindout;
+          else
+            {
+              if( rangeindout[i]==GAL_BLANK_SIZE_T )
+                {
+                  rangeindout[i]=allncols++;
+                  gal_list_str_add(&add, dtmp->name, 0);
+                }
+            }
+          ++i;
+        }
+    }
+
+
+  /* Add the possibly new set of columns to read. */
+  if(add)
+    {
+      gal_list_str_reverse(&add);
+      for(stmp=p->columns; stmp!=NULL; stmp=stmp->next)
+        if(stmp->next==NULL) { stmp->next=add; break; }
+    }
+
+
+  /* Clean up. */
+  if(rangeind) free(rangeind);
+  gal_list_sizet_free(indexll);
+  gal_data_array_free(allcols, numcols, 0);
+}
+
+
+
+
+
+static void
+ui_check_range_sort_after(struct tableparams *p, size_t nrange,
+                          size_t origoutncols, size_t sortindout,
+                          size_t *rangeindout)
+{
+  struct list_range *rtmp;
+  size_t i, j, *rangein=NULL;
+  gal_data_t *tmp, *last=NULL;
+
+  /* Allocate the necessary arrays. */
+  if(p->range)
+    {
+      rangein=gal_pointer_allocate(GAL_TYPE_UINT8, nrange, 0,
+                                   __func__, "rangein");
+      p->freerange=gal_pointer_allocate(GAL_TYPE_UINT8, nrange, 1,
+                                        __func__, "p->freerange");
+    }
+
+
+  /* Set the proper pointers. For `rangecol' we'll need to do it separately
+     (because the orders can get confused).*/
+  i=0;
+  for(tmp=p->table; tmp!=NULL; tmp=tmp->next)
+    {
+      if(i==origoutncols-1)           last=tmp;
+      if(p->sort && i==sortindout) p->sortcol=tmp;
+      ++i;
+    }
+
+
+  /* Find the range columns. */
+  for(i=0;i<nrange;++i)
+    {
+      j=0;
+      for(tmp=p->table; tmp!=NULL; tmp=tmp->next)
+        {
+          if(j==rangeindout[i])
+            {
+              ui_list_range_add(&p->rangecol, tmp);
+              break;
+            }
+          ++j;
+        }
+    }
+  ui_list_range_reverse(&p->rangecol);
+
+
+  /* Terminate the actual table where it should be terminated (by setting
+     `last->next' to NULL. */
+  last->next=NULL;
+
+
+  /*  Also, remove any possibly existing `next' pointer for `sortcol' and
+     `rangecol'. */
+  if(p->sort && sortindout>=origoutncols)
+    { p->sortcol->next=NULL;  p->freesort=1; }
+  else p->sortin=1;
+  if(p->range)
+    {
+      i=0;
+      for(rtmp=p->rangecol;rtmp!=NULL;rtmp=rtmp->next)
+        {
+          if(rangeindout[i]>=origoutncols)
+            {
+              rtmp->v->next=NULL;
+              p->freerange[i] = (rtmp->v==p->sortcol) ? 0 : 1;
+            }
+          else rangein[i]=1;
+          ++i;
+        }
+    }
+
+
+  /* Clean up. */
+  if(rangein) free(rangein);
+}
+
+
+
+
+
+
 static void
 ui_preparations(struct tableparams *p)
 {
   gal_list_str_t *lines;
+  size_t nrange=0, origoutncols=0;
   struct gal_options_common_params *cp=&p->cp;
+  size_t sortindout=GAL_BLANK_SIZE_T, *rangeindout=NULL;
 
   /* If there were no columns specified or the user has asked for
      information on the columns, we want the full set of columns. */
   if(p->information)
     ui_print_info_exit(p);
 
+
   /* Prepare the column names. */
   ui_columns_prepare(p);
 
-  /* Read in the table columns. */
+
+  /* If the input is from stdin, save it as `lines'. */
   lines=gal_options_check_stdin(p->filename, p->cp.stdintimeout, "input");
+
+
+  /* If sort or range are given, see if we should read them also. */
+  if(p->range || p->sort)
+    ui_check_range_sort_before(p, lines, &nrange, &origoutncols, &sortindout,
+                               &rangeindout);
+
+
+  /* Read the necessary columns. */
   p->table=gal_table_read(p->filename, cp->hdu, lines, p->columns,
                           cp->searchin, cp->ignorecase, cp->minmapsize,
                           NULL);
-  if(p->filename==NULL) p->filename="Standard-input";
+  if(p->filename==NULL) p->filename="stdin";
   gal_list_str_free(lines, 1);
 
+
+  /* If the range and sort options are requested, keep them as separate
+     datasets. */
+  if(p->range || p->sort)
+    ui_check_range_sort_after(p, nrange, origoutncols, sortindout,
+                              rangeindout);
+
+
   /* If there was no actual data in the file, then inform the user and
      abort. */
   if(p->table==NULL)
     error(EXIT_FAILURE, 0, "%s: no usable data rows (non-commented and "
           "non-blank lines)", p->filename);
 
+
   /* Now that the data columns are ready, we can free the string linked
      list. */
   gal_list_str_free(p->columns, 1);
   p->columns=NULL;
+
+
+  /* Make sure the (possible) output name is writable. */
+  gal_checkset_writable_remove(p->cp.output, 0, p->cp.dontdelete);
+
+
+  /* Clean up. */
+  if(rangeindout) free(rangeindout);
 }
 
 
diff --git a/bin/table/ui.h b/bin/table/ui.h
index e1f0d84..da7fce7 100644
--- a/bin/table/ui.h
+++ b/bin/table/ui.h
@@ -32,7 +32,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 /* Available letters for short options:
 
-   a b d e f g j k l m n p r t u v w x y z
+   a b d e f g j k l m n p t u v w x y z
    A B C E G H J L O Q R W X Y
 */
 enum option_keys_enum
@@ -40,7 +40,10 @@ enum option_keys_enum
   /* With short-option version. */
   UI_KEY_COLUMN          = 'c',
   UI_KEY_INFORMATION     = 'i',
-  UI_KEY_COLINFOINSTDOUT = 's',
+  UI_KEY_COLINFOINSTDOUT = 'O',
+  UI_KEY_RANGE           = 'r',
+  UI_KEY_SORT            = 's',
+  UI_KEY_DESCENDING      = 'd',
 
   /* Only with long version (start with a value 1000, the rest will be set
      automatically). */
@@ -54,6 +57,9 @@ void
 ui_read_check_inputs_setup(int argc, char *argv[], struct tableparams *p);
 
 void
+ui_list_range_free(struct list_range *list, int freevalue);
+
+void
 ui_free_report(struct tableparams *p);
 
 #endif
diff --git a/bin/warp/astwarp.conf b/bin/warp/astwarp.conf
index 26a3af4..6b2604e 100644
--- a/bin/warp/astwarp.conf
+++ b/bin/warp/astwarp.conf
@@ -12,6 +12,8 @@
 #  $ info astwarp                        # All options and input/output.
 #  $ info gnuastro "Configuration files" # How to use configuration files.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
 # Copying and distribution of this file, with or without modification, are
 # permitted in any medium without royalty provided the copyright notice and
 # this notice are preserved.  This file is offered as-is, without any
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 697e2ee..d778a33 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -348,6 +348,9 @@ ui_check_options_and_arguments(struct warpparams *p)
       if(p->input->wcs)
         {
           p->pixelscale=gal_wcs_pixel_scale(p->input->wcs);
+          if(p->pixelscale==NULL)
+            error(EXIT_FAILURE, 0, "%s (hdu %s): the pixel scale couldn't "
+                  "be deduced from the WCS.", p->inputname, p->cp.hdu);
           p->inwcsmatrix=gal_wcs_warp_matrix(p->input->wcs);
         }
     }
diff --git a/bootstrap.conf b/bootstrap.conf
index 82baa12..8814be2 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -215,18 +215,22 @@ gnulib_modules="
     func
     math
     argp
+    time
     fcntl
     regex
     error
     nproc
     stdint
     strtod
+    mktime
     getline
     strcase
     gendocs
     gpl-3.0
     mbstok_r
     inttypes
+    sys_time
+    strptime
     faccessat
     system-posix
     secure_getenv
diff --git a/bootstrapped/README b/bootstrapped/README
index b9b5dfa..73adb0f 100644
--- a/bootstrapped/README
+++ b/bootstrapped/README
@@ -1,6 +1,9 @@
 Imported files to GNU Astronomy Utilities
 =========================================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 The contents of this directory (except this README file!) are imported
 to GNU Astronomy Utilities (Gnuastro) from other projects. Therefore
 they are not maintained by Gnuastro developers and are kept separately
@@ -36,4 +39,20 @@ The projects that were used are:
 
 We are most grateful to the maintainers of these projects which allow
 Gnuastro to be easily installed on a very large set of Unix-like
-operating systems.
\ No newline at end of file
+operating systems.
+
+
+
+
+
+Copyright information
+---------------------
+
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the
+license is included in the "GNU Free Documentation License" file as part of
+this distribution.
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 9318393..ee6654a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -804,6 +804,7 @@ AC_CONFIG_FILES([Makefile
                  bin/table/Makefile
                  bin/match/Makefile
                  bin/mkprof/Makefile
+                 bin/script/Makefile
                  bin/mknoise/Makefile
                  bin/segment/Makefile
                  bin/convertt/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8929b31..6cdeef6 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -137,7 +137,7 @@ dist_man_MANS = $(MAYBE_ARITHMETIC_MAN) 
$(MAYBE_BUILDPROG_MAN)          \
   $(MAYBE_CROP_MAN) $(MAYBE_FITS_MAN) $(MAYBE_MATCH_MAN)                \
   $(MAYBE_MKCATALOG_MAN) $(MAYBE_MKNOISE_MAN) $(MAYBE_MKPROF_MAN)       \
   $(MAYBE_NOISECHISEL_MAN) $(MAYBE_SEGMENT_MAN) $(MAYBE_STATISTICS_MAN) \
-  $(MAYBE_TABLE_MAN) $(MAYBE_WARP_MAN)
+  $(MAYBE_TABLE_MAN) $(MAYBE_WARP_MAN) man/astscript-sort-by-night.1
 
 
 ## See if help2man is present or not. When help2man doesn't exist, we don't
@@ -203,6 +203,11 @@ man/astnoisechisel.1: $(top_srcdir)/bin/noisechisel/args.h 
 $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "detect signal in a noisy image"              \
                          --libtool $(toputildir)/noisechisel/astnoisechisel
 
+man/astscript-sort-by-night.1: $(top_srcdir)/bin/script/sort-by-night.in   \
+                               $(ALLMANSDEP)
+       $(MAYBE_HELP2MAN) -n "Sort input FITS files by night"              \
+                         --libtool $(toputildir)/script/astscript-sort-by-night
+
 man/astsegment.1: $(top_srcdir)/bin/segment/args.h  $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "segmentation based on signal structure"      \
                          --libtool $(toputildir)/segment/astsegment
diff --git a/doc/README b/doc/README
index d65239c..f1693e5 100644
--- a/doc/README
+++ b/doc/README
@@ -1,6 +1,9 @@
 Documentation of GNU Astronomy Utilities
 ========================================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 This directory contains the documentation (manual) of GNU Astronomy
 Utilities (Gnuastro) and also all the files necessary for the Gnuastro
 webpage. Note that only the basic files needed to make the webpage are
@@ -43,3 +46,20 @@ directories. Just note that CVS is an antique(!) and so you 
have to
 add all the files in separate directories separately, first add the
 directory, then CVS will find the untracked files inside it and add
 them one by one!
+
+Image copyright
+---------------
+
+This directory also contains the `gnuastrologo.xcf' image which is a crude
+logo for Gnuastro in case we need it. It is released under the GNU Free
+Documentation License, Version 1.3 or later, just like this README
+(statement is at the bottom of this file)
+
+Copyright
+---------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 02c7b76..97a8052 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,7 +1,17 @@
 Alphabetically ordered list to acknowledge in the next release.
 
-Roberto Baena Gallé
-Leindert Boogaard
-Raúl Infante Sainz
 David Valls-Gabaud
-Ignacio Trujillo
+
+
+
+
+
+
+
+
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
diff --git a/doc/formath.texi b/doc/formath.texi
index 6b427cf..ce9c276 100644
--- a/doc/formath.texi
+++ b/doc/formath.texi
@@ -12,6 +12,8 @@ For the other formats, everything is normal, except the 
display math
 equations that don't have any proper solution, so I have just put a $$
 $$ around the math.
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
 notice and this notice are preserved.  This file is offered as-is,
diff --git a/doc/gnuastro-figures/README b/doc/gnuastro-figures/README
new file mode 100644
index 0000000..44b56fe
--- /dev/null
+++ b/doc/gnuastro-figures/README
@@ -0,0 +1,29 @@
+Directory for images used in book
+=================================
+
+In the raw Git project, this directory contains raw images that are used in
+the book and are not produced by the bootstrapping). After bootstrapping it
+will be populated with several derivative/created images.
+
+The details of each image (including a copyright) is given below:
+
+epicycles.png: This is a combined image from two images on Wikipedia (links
+  below). On Wikipedia, they both have the GNU Free Documentation License,
+  Version 1.2 or later.  This combined image is released under GNU Free
+  Documentation License, Version 1.3, similar to this README file
+  (statement is at the bottom of this file).
+    https://commons.wikimedia.org/wiki/File:Ghotb2.jpg
+    
https://commons.wikimedia.org/wiki/File:Fourier_series_sawtooth_wave_circles_animation.gif
+
+
+
+
+
+Copyright information
+---------------------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/doc/gnuastro.en.html b/doc/gnuastro.en.html
index a0cd4e2..eba3998 100644
--- a/doc/gnuastro.en.html
+++ b/doc/gnuastro.en.html
@@ -85,9 +85,9 @@ for entertaining and easy to read real world examples of using
 
 <p>
   The current stable release
-  is <a href="http://ftp.gnu.org/gnu/gnuastro/gnuastro-0.8.tar.gz";>Gnuastro
-  0.8</a> (December 28th, 2018).
-  Use <a href="http://ftpmirror.gnu.org/gnuastro/gnuastro-0.8.tar.gz";>a
+  is <a href="http://ftp.gnu.org/gnu/gnuastro/gnuastro-0.9.tar.gz";>Gnuastro
+  0.9</a> (April 17th, 2019).
+  Use <a href="http://ftpmirror.gnu.org/gnuastro/gnuastro-0.9.tar.gz";>a
   mirror</a> if possible.
 
   <!-- Comment the test release notice when the test release is not more
@@ -98,7 +98,7 @@ for entertaining and easy to read real world examples of using
   To stay up to date, please subscribe.</p>
 
 <p>For details of the significant changes in this release, please see the
-  <a 
href="https://git.savannah.gnu.org/cgit/gnuastro.git/plain/NEWS?id=gnuastro_v0.8";>NEWS</a>
+  <a 
href="https://git.savannah.gnu.org/cgit/gnuastro.git/plain/NEWS?id=gnuastro_v0.9";>NEWS</a>
   file.</p>
 
 <p>The
diff --git a/doc/gnuastro.fr.html b/doc/gnuastro.fr.html
index 043a1d5..ee9f654 100644
--- a/doc/gnuastro.fr.html
+++ b/doc/gnuastro.fr.html
@@ -85,15 +85,15 @@ h3 { clear: both; }
 <h3 id="download">Téléchargement</h3>
 
 <p>La version stable actuelle
-  est <a href="https://ftp.gnu.org/gnu/gnuastro/gnuastro-0.8.tar.gz";>Gnuastro
-  0.8</a> (sortie le 28 décembre
-  2018). Utilisez <a 
href="https://ftpmirror.gnu.org/gnuastro/gnuastro-0.8.tar.gz";>un
+  est <a href="https://ftp.gnu.org/gnu/gnuastro/gnuastro-0.9.tar.gz";>Gnuastro
+  0.9</a> (sortie le 28 avril
+  2019). Utilisez <a 
href="https://ftpmirror.gnu.org/gnuastro/gnuastro-0.9.tar.gz";>un
   miroir</a> si possible.  <br />Les nouvelles publications sont annoncées
   sur <a 
href="https://lists.gnu.org/mailman/listinfo/info-gnuastro";>info-gnuastro</a>.
   Abonnez-vous pour rester au courant.</p>
 
 <p>Les changements importants sont décrits dans le
-  fichier <a 
href="https://git.savannah.gnu.org/cgit/gnuastro.git/plain/NEWS?id=gnuastro_v0.8";>
+  fichier <a 
href="https://git.savannah.gnu.org/cgit/gnuastro.git/plain/NEWS?id=gnuastro_v0.9";>
   NEWS</a>.</p>
 
 <p>Le lien
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index c01fa0e..f4f3c62 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -99,6 +99,8 @@ License''.
 * Warp: (gnuastro)Warp. Warp a dataset to a new grid.
 * astwarp: (gnuastro)Invoking astwarp. Options to Warp.
 
+* astscript-sort-by-night: (gnuastro)Invoking astscript-sort-by-night. Options 
to this script
+
 @end direntry
 
 
@@ -292,6 +294,7 @@ Common program behavior
 * Command-line::                How to use the command-line.
 * Configuration files::         Values for unspecified variables.
 * Getting help::                Getting more information on the go.
+* Installed scripts::           Installed Bash scripts, not compiled programs.
 * Multi-threaded operations::   How threads are managed in Gnuastro.
 * Numeric data types::          Different types and how to specify them.
 * Tables::                      Recognized table formats.
@@ -349,6 +352,7 @@ Recognized table formats
 Data containers
 
 * Fits::                        View and manipulate extensions and keywords.
+* Sort FITS files by night::    Installed script to sort FITS files by obs 
night.
 * ConvertType::                 Convert data to various formats.
 * Table::                       Read and Write FITS tables to plain text.
 
@@ -361,6 +365,10 @@ Invoking Fits
 * HDU manipulation::            Manipulate HDUs within a FITS file.
 * Keyword manipulation::        Manipulate metadata keywords in a HDU
 
+Sort FITS files by night
+
+* Invoking astscript-sort-by-night::  Inputs and outputs to this script.
+
 ConvertType
 
 * Recognized file formats::     Recognized file formats
@@ -1734,23 +1742,24 @@ particular in collaboration with Johan Knapen and 
Ignacio Trujillo.
 In general, we would like to gratefully thank the following people for
 their useful and constructive comments and suggestions (in alphabetical
 order by family name): Valentina Abril-melgarejo, Marjan Akbari, Roland
-Bacon, Karl Berry, Leindert Boogaard, Nicolas Bouch@'e, Fernando Buitrago,
-Adrian Bunk, Rosa Calvi, Nushkia Chamba, Benjamin Clement, Nima Dehdilani,
-Antonio Diaz Diaz, Pierre-Alain Duc, Gaspar Galaz, Th@'er@`ese Godefroy,
-Madusha Gunawardhana, Stephen Hamer, Takashi Ichikawa, Ra@'ul Infante
-Sainz, Brandon Invergo, Oryna Ivashtenko, Aur@'elien Jarno, Lee Kelvin,
-Brandon Kelly, Mohammad-Reza Khellat, Johan Knapen, Geoffry Krouchi,
-Floriane Leclercq, Alan Lefor, Guillaume Mahler, Juan Molina Tobar,
-Francesco Montanari, Dmitrii Oparin, Bertrand Pain, William Pence, Mamta
-Pommier, Bob Proulx, Teymoor Saifollahi, Yahya Sefidbakht, Alejandro
-Serrano Borlaff, Jenny Sorce, Lee Spitler, Richard Stallman, Michael Stein,
-Ole Streicher, Alfred M. Szmidt, Michel Tallon, Juan C. Tello, @'Eric
-Thi@'ebaut, Ignacio Trujillo, David Valls-Gabaud, Aaron Watkins,
-Christopher Willmer, Sara Yousefi Taemeh, Johannes Zabl. The GNU French
-Translation Team is also managing the French version of the top Gnuastro
-webpage which we highly appreciate. Finally we should thank all the
-(sometimes anonymous) people in various online forums which patiently
-answered all our small (but important) technical questions.
+Bacon, Roberto Baena Gall\'e, Karl Berry, Leindert Boogaard, Nicolas
+Bouch@'e, Fernando Buitrago, Adrian Bunk, Rosa Calvi, Nushkia Chamba,
+Benjamin Clement, Nima Dehdilani, Antonio Diaz Diaz, Pierre-Alain Duc,
+Elham Eftekhari, Gaspar Galaz, Th@'er@`ese Godefroy, Madusha Gunawardhana,
+Stephen Hamer, Takashi Ichikawa, Ra@'ul Infante Sainz, Brandon Invergo,
+Oryna Ivashtenko, Aur@'elien Jarno, Lee Kelvin, Brandon Kelly,
+Mohammad-Reza Khellat, Johan Knapen, Geoffry Krouchi, Floriane Leclercq,
+Alan Lefor, Guillaume Mahler, Juan Molina Tobar, Francesco Montanari,
+Dmitrii Oparin, Bertrand Pain, William Pence, Mamta Pommier, Bob Proulx,
+Teymoor Saifollahi, Yahya Sefidbakht, Alejandro Serrano Borlaff, Jenny
+Sorce, Lee Spitler, Richard Stallman, Michael Stein, Ole Streicher, Alfred
+M. Szmidt, Michel Tallon, Juan C. Tello, @'Eric Thi@'ebaut, Ignacio
+Trujillo, David Valls-Gabaud, Aaron Watkins, Christopher Willmer, Sara
+Yousefi Taemeh, Johannes Zabl. The GNU French Translation Team is also
+managing the French version of the top Gnuastro webpage which we highly
+appreciate. Finally we should thank all the (sometimes anonymous) people in
+various online forums which patiently answered all our small (but
+important) technical questions.
 
 All work on Gnuastro has been voluntary, but the authors are most grateful
 to the following institutions (in chronological order) for hosting us in
@@ -7217,6 +7226,7 @@ store some very useful information in the header that is 
discussed in
 * Command-line::                How to use the command-line.
 * Configuration files::         Values for unspecified variables.
 * Getting help::                Getting more information on the go.
+* Installed scripts::           Installed Bash scripts, not compiled programs.
 * Multi-threaded operations::   How threads are managed in Gnuastro.
 * Numeric data types::          Different types and how to specify them.
 * Tables::                      Recognized table formats.
@@ -8452,7 +8462,12 @@ source by your self as in @ref{Quick start}.
 
 
 
-@node Getting help, Multi-threaded operations, Configuration files, Common 
program behavior
+
+
+
+
+
+@node Getting help, Installed scripts, Configuration files, Common program 
behavior
 @section Getting help
 
 @cindex Help
@@ -8766,7 +8781,101 @@ list. We have other mailing lists and tools for those 
purposes, see
 
 
 
-@node Multi-threaded operations, Numeric data types, Getting help, Common 
program behavior
+
+
+
+
+
+@node Installed scripts, Multi-threaded operations, Getting help, Common 
program behavior
+@section Installed scripts
+
+Gnuastro's programs (introduced in previous chapters) are designed to be
+highly modular and thus mainly contain lower-level operations on the
+data. However, in many contexts, higher-level operations (for example a
+sequence of calls to multiple Gnuastro programs, or a special way of
+running a program and using the outputs) are also very similar between
+various projects.
+
+To facilitate data analysis on these higher-level steps also, Gnuastro also
+installs some scripts on your system with the (@code{astscript-}) prefix
+(in contrast to the other programs that only have the @code{ast}
+prefix).
+
+@cindex GNU Bash
+Like all of Gnuastro's source code, these scripts are also heavily
+commented. They are written in GNU Bash, which doesn't need
+compilation. Therefore, if you open the installed scripts in a text editor,
+you can actually read them@footnote{Gnuastro's installed programs (those
+only starting with @code{ast}) aren't human-readable. They are written in C
+and are thus compiled (optimized in binary CPU instructions that will be
+given directly to your CPU). Because they don't need an interpretter like
+Bash on every run, they are much faster and more independent than
+scripts. To read the source code of the programs, look into the
+@file{bin/progname} directory of Gnuastro's source (@ref{Downloading the
+source}). If you would like to read more about why C was chosen for the
+programs, please see @ref{Why C}.}. Bash is the same language that is
+mainly used when typing on the command-line. Because of these factors, Bash
+is much more widely known and used than C (the language of other Gnuastro
+programs). Gnuastro's installed scripts also do higher-level operations, so
+customizing these scripts for a special project will be more common than
+the programs. You can always inspect them (to customize, check, or educate
+your self) with this command (just replace @code{emacs} with your favorite
+text editor):
+
+@example
+$ emacs $(which astscript-NAME)
+@end example
+
+These scripts also accept options and are in many ways similar to the
+programs (see @ref{Common options}) with some minor differences:
+
+@itemize
+@item
+Currently they don't accept configuration files themselves. However, the
+configuration files of the Gnuastro programs they call are indeed parsed
+and used by those programs.
+
+As a result, they don't have the following options: @option{--checkconfig},
+@option{--config}, @option{--lastconfig}, @option{--onlyversion},
+@option{--printparams}, @option{--setdirconf} and @option{--setusrconf}.
+
+@item
+They don't directly allocate any memory, so there is no
+@option{--minmapsize}.
+
+@item
+They don't have an independent @option{--usage} option: when called with
+@option{--usage}, they just recommend running @option{--help}.
+
+@item
+The output of @option{--help} is not configurable like the programs (see
+@ref{--help}).
+
+@item
+@cindex GNU AWK
+@cindex GNU SED
+The scripts will commonly use your installed Bash and other basic
+command-line tools (for example AWK or SED). Different systems have
+different versions and implementations of these basic tools (for example
+GNU/Linux systems use GNU AWK and GNU SED which are far more advanced and
+up to date then the minimalist AWK and SED of most other
+systems). Therefore, unexpected errors in these tools might come up when
+you run these scripts. We will try our best to write these scripts in a
+portable way. However, if you do confront such strange errors, please
+submit a bug report so we fix it (see @ref{Report a bug}).
+
+@end itemize
+
+
+
+
+
+
+
+
+
+
+@node Multi-threaded operations, Numeric data types, Installed scripts, Common 
program behavior
 @section Multi-threaded operations
 
 @pindex nproc
@@ -9873,6 +9982,7 @@ save them into another plain text or FITS table.
 
 @menu
 * Fits::                        View and manipulate extensions and keywords.
+* Sort FITS files by night::    Installed script to sort FITS files by obs 
night.
 * ConvertType::                 Convert data to various formats.
 * Table::                       Read and Write FITS tables to plain text.
 @end menu
@@ -9881,7 +9991,7 @@ save them into another plain text or FITS table.
 
 
 
-@node Fits, ConvertType, Data containers, Data containers
+@node Fits, Sort FITS files by night, Data containers, Data containers
 @section Fits
 
 @cindex Vatican library
@@ -10362,7 +10472,7 @@ The reason you need to use @key{/} as the keyword name 
for setting a title
 is that @key{/} is the first non-white character.
 
 The title(s) is(are) written into the FITS with the same order that
-@option{--write} is called. Therefore in one run of the Fits progarm, you
+@option{--write} is called. Therefore in one run of the Fits program, you
 can specify many different titles (with their own keywords under them). For
 example the command below that builds on the previous example and adds
 another group of keywords named @code{A1} and @code{A2}.
@@ -10452,7 +10562,7 @@ will print @code{NOT-PRESENT}, and if they cannot be 
verified it will print
 can't be verified), the Fits program will also return with a failure.
 
 By default this function will also print a short description of the
-@code{DATASUM} AND @code{CHECKSUM} keywords. You can supress this extra
+@code{DATASUM} AND @code{CHECKSUM} keywords. You can suppress this extra
 information with @code{--quiet} option.
 
 @item --copykeys=INT:INT
@@ -10485,6 +10595,32 @@ Quit if any of the operations above are not 
successful. By default if
 an error occurs, Fits will warn the user of the faulty keyword and
 continue with the rest of actions.
 
+@item -s STR
+@itemx --datetosec STR
+@cindex Unix epoch time
+@cindex Time, Unix epoch
+@cindex Epoch, Unix time
+Interpret the value of the given keyword in the FITS date format (most
+generally: @code{YYYY-MM-DDThh:mm:ss.ddd...}) and return the corresponding
+Unix epoch time (number of seconds that have passed since 00:00:00
+Thursday, January 1st, 1970). The @code{Thh:mm:ss.ddd...} section
+(specifying the time of day), and also the @code{.ddd...} (specifying the
+fraction of a second) are optional. The value to this option must be the
+FITS keyword name that contains the requested date, for example
+@option{--datetosec=DATE-OBS}.
+
+@cindex GNU C Library
+This option can also interpret the older FITS date format
+(@code{DD/MM/YYThh:mm:ss.ddd...}) where only two characters are given to
+the year. In this case (following the GNU C Library), this option will make
+the following assumption: values 68 to 99 correspond to the years 1969 to
+1999, and values 0 to 68 as the years 2000 to 2068.
+
+This is a very useful option for operations on the FITS date values, for
+example sorting FITS files by their dates, or finding the time difference
+between two FITS files. The advantage of working with the Unix epoch time
+is that you don't have to worry about calendar details (for example the
+number of days in different months, or leap years, and etc).
 @end table
 
 
@@ -10500,7 +10636,256 @@ continue with the rest of actions.
 
 
 
-@node ConvertType, Table, Fits, Data containers
+
+
+
+
+
+
+@node Sort FITS files by night, ConvertType, Fits, Data containers
+@section Sort FITS files by night
+
+@cindex Calendar
+FITS images usually contain (several) keywords for preserving important
+dates. In particular, for lower-level data, this is usually the observation
+date and time (for example, stored in the @code{DATE-OBS} keyword
+value). When analyzing observed datasets, many calibration steps (like the
+dark, bias or flat-field), are commonly calculated on a per-observing-night
+basis.
+
+However, the FITS standard's date format (@code{YYYY-MM-DDThh:mm:ss.ddd})
+is based on the western (Gregorian) calendar. Dates that are stored in this
+format are complicated for automatic processing: a night starts in the
+final hours of one calendar day, and extends to the early hours of the next
+calendar day. As a result, to identify datasets from one night, we commonly
+need to search for two dates. However calendar peculiarities can make this
+identification very difficult. For example when an observation is done on
+the night separating two months (like the night starting on March 31st and
+going into April 1st), or two years (like the night starting on December
+31st 2018 and going into January 1st, 2019). To account for such
+situations, it is necessary to keep track of how many days are in a month,
+and leap years, and etc.
+
+@cindex Unix epoch time
+@cindex Time, Unix epoch
+@cindex Epoch, Unix time
+Gnuastro's @file{astscript-sort-by-night} script is created to help in such
+important scenarios. It uses @ref{Fits} to convert the FITS date format
+into the Unix epoch time (number of seconds since 00:00:00 of January 1st,
+1970), using the @option{--datetosec} option. The Unix epoch time is a
+single number (integer, if not given in sub-second precision), enabling
+easy comparison and sorting of dates after January 1st, 1970.
+
+You can use this script as a basis for making a much more highly customized
+sorting script. Here are some examples
+
+@itemize
+@item
+If you need to copy the files, but only need a single extension (not the
+whole file), you can add a step just before the making of the symbolic
+links, or copies, and change it to only copy a certain extension of the
+FITS file using the Fits program's @option{--copy} option, see @ref{HDU
+manipulation}.
+
+@item
+If you need to classify the files with finer detail (for example the
+purpose of the dataset), you can add a step just before the making of the
+symbolic links, or copies, to specify a file-name prefix based on other
+certain keyword values in the files. For example when the FITS files have a
+keyword to specify if the dataset is a science, bias, or flat-field
+image. You can read it and to add a @code{sci-}, @code{bias-}, or
+@code{flat-} to the created file (after the @option{--prefix})
+automatically.
+
+For example, let's assume the observing mode is stored in the hypothetical
+@code{MODE} keyword, which can have three values of @code{BIAS-IMAGE},
+@code{SCIENCE-IMAGE} and @code{FLAT-EXP}. With the step below, you can
+generate a mode-prefix, and add it to the generated link/copy names (just
+correct the filename and extension of the first line to the script's
+variables):
+
+@example
+modepref=$(astfits infile.fits -h1 \
+                   | sed -e"s/'/ /g" \
+                   | awk '$1=="MODE"@{ \
+                       if($3=="BIAS-IMAGE") print "bias-"; \
+                       else if($3=="SCIENCE-IMAGE") print "sci-"; \
+                       else if($3==FLAT-EXP) print "flat-"; \
+                       else print $3, "NOT recognized"; exit 1@}')
+@end example
+
+@cindex GNU AWK
+@cindex GNU Sed
+Here is a description of it. We first use @command{astfits} to print all
+the keywords in extension @code{1} of @file{infile.fits}. In the FITS
+standard, string values (that we are assuming here) are placed in single
+quotes (@key{'}) which are annoying in this context/use-case. Therefore, we
+pipe the output of @command{astfits} into @command{sed} to remove all such
+quotes (substituting them with a blank space). The result is then piped to
+AWK for giving us the final mode-prefix: with @code{$1=="MODE"}, we ask AWK
+to only consider the line where the first column is @code{MODE}. There is
+an equal sign between the key name and value, so the value is the third
+column (@code{$3} in AWK). We thus use a simple @code{if-else} structure to
+look into this value and print our custom prefix based on it. The output of
+AWK is then stored in the @code{modepref} shell variable which you can add
+to the link/copy name.
+
+With the solution above, the increment of the file counter for each night
+will be independent of the mode. If you want the counter to be
+mode-dependent, you can add a different counter for each mode and use that
+counter instead of the generic counter for each night (based on the value
+of @code{modepref}). But we'll leave the implementation of this step to you
+as an exercise.
+
+@end itemize
+
+@menu
+* Invoking astscript-sort-by-night::  Inputs and outputs to this script.
+@end menu
+
+@node Invoking astscript-sort-by-night,  , Sort FITS files by night, Sort FITS 
files by night
+@subsection Invoking astscript-sort-by-night
+
+This installed script will read a FITS date formatted value from the given
+keyword, and classify the input FITS files into individual nights. For more
+on installed scripts please see (see @ref{Installed scripts}). This script
+can be used with the following general template:
+
+@example
+$ astscript-sort-by-night [OPTION...] FITS-files
+@end example
+
+@noindent
+One line examples:
+
+@example
+## Use the DATE-OBS keyword
+$ astscript-sort-by-night --key=DATE-OBS /path/to/data/*.fits
+
+## Make links to the input files with the `img-' prefix
+$ astscript-sort-by-night --link --prefix=img- /path/to/data/*.fits
+@end example
+
+This script will look into a HDU/extension (@option{--hdu}) for a keyword
+(@option{--key}) in the given FITS files and interpret the value as a
+date. The inputs will be separated by "night"s (9:00a.m to next day's
+8:59:59a.m, spanning two calendar days, exact hour can be set with
+@option{--hour}).
+
+The default output is a list of all the input files along with the
+following two columns: night number and file number in that night (sorted
+by time). With @option{--link} a symbolic link will be made (one for each
+input) that contains the night number, and number of file in that night
+(sorted by time), see the description of @option{--link} for more. When
+@option{--copy} is used instead of a link, a copy of the inputs will be
+made instead of symbolic link.
+
+Below you can see one example where all the @file{target-*.fits} files in
+the @file{data} directory should be separated by observing night according
+to the @code{DATE-OBS} keyword value in their second extension (number
+@code{1}, recall that HDU counting starts from 0). You can see the output
+after the @code{ls} command.
+
+@example
+$ astscript-sort-by-night -pimg- -h1 -kDATE-OBS data/target-*.fits
+$ ls
+img-n1-1.fits img-n1-2.fits img-n2-1.fits ...
+@end example
+
+The outputs can be placed in a different (already existing) directory by
+including that directory's name in the @option{--prefix} value, for example
+@option{--prefix=sorted/img-} will put them all under the @file{sorted}
+directory.
+
+This script can be configured like all Gnuastro's programs (through
+command-line options, see @ref{Common options}), with some minor
+differences that are described in @ref{Installed scripts}. The particular
+options to this script are listed below:
+
+@table @option
+@item -h STR
+@itemx --hdu=STR
+The HDU/extension to use in all the given FITS files. All of the given FITS
+files must have this extension.
+
+@item -k STR
+@itemx --key=STR
+The keyword name that contains the FITS date format to classify/sort by.
+
+@item -H FLT
+@itemx --hour=FLT
+The hour that defines the next ``night''. By default, all times before
+9:00a.m are considered to belong to the previous calendar night. If a
+sub-hour value is necessary, it should be given in units of hours, for
+example @option{--hour=9.5} corresponds to 9:30a.m.
+
+@item -l
+@itemx --link
+Create a symbolic link for each input FITS file. This option cannot be used
+with @option{--copy}. The link will have a standard name in the following
+format (variable parts are written in @code{CAPITAL} letters and described
+after it):
+
+@example
+PnN-I.fits
+@end example
+
+@table @code
+@item P
+This is the value given to @option{--prefix}. By default, its value is
+@code{./} (to store the links in the directory this script was run in). See
+the description of @code{--prefix} for more.
+@item N
+This is the night-counter: starting from 1. @code{N} is just incremented by
+1 for the next night, no matter how many nights (without any dataset) there
+are between two subsequent observing nights (its just an identifier for
+each night which you can easily map to different calendar nights).
+@item I
+File counter in that night, sorted by time.
+@end table
+
+@item -c
+@itemx --copy
+Make a copy of each input FITS file with the standard naming convention
+described in @option{--link}. With this option, instead of making a link, a
+copy is made. This option cannot be used with @option{--link}.
+
+@item -p STR
+@itemx --prefix=STR
+Prefix to append before the night-identifier of each newly created link or
+copy. This option is thus only relevant with the @option{--copy} or
+@option{--link} options. See the description of @option{--link} for how its
+used. For example, with @option{--prefix=img-}, all the created file names
+in the current directory will start with @code{img-}, making outputs like
+@file{img-n1-1.fits} or @file{img-n3-42.fits}.
+
+@option{--prefix} can also be used to store the links/copies in another
+directory relative to the directory this script is being run (it must
+already exist). For example @code{--prefix=/path/to/processing/img-} will
+put all the links/copies in the @file{/path/to/processing} directory, and
+the files (in that directory) will all start with @file{img-}.
+@end table
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@node ConvertType, Table, Sort FITS files by night, Data containers
 @section ConvertType
 
 @cindex Data format conversion
@@ -11109,6 +11494,18 @@ want them all to have the same range of colors, 
independent of the contents
 of the dataset. Note that if the minimum value is smaller than
 @option{--fluxlow}, then this option is redundant.
 
+@cindex PDF
+@cindex EPS
+@cindex PostScript
+By default, when the dataset only has two values, @emph{and} the output
+format is PDF or EPS, ConvertType will use the PostScript optimization that
+allows setting the pixel values per bit, not byte (@ref{Recognized file
+formats}). This can greatly help reduce the file size. However, when
+@option{--fluxlow} or @option{--fluxhigh} are called, this optimization is
+disabeled: even though there are only two values (is binary), the
+difference between them does not correspond to the full contrast of black
+and white.
+
 @item -B INT
 @itemx --forcemax=INT
 Similar to @option{--forcemin}, but for the maximum.
@@ -11206,8 +11603,18 @@ $ asttable bintab.fits --information
 ## the name starts with "MAG_":
 $ asttable bintab.fits --column=RA --column=DEC --column=/^MAG_/
 
-## Similar to above, but with one call to --column (or -c) and writes
-## the columns to a file (with metadata) instead of the command-line.
+## Similar to the above, but with one call to `--column' (or `-c'),
+## also sort the rows by the input's photometric redshift (`Z_PHOT')
+## column. To confirm the sort, you can add `Z_PHOT' to the columns
+## to print.
+$ asttable bintab.fits -cRA,DEC,/^MAG_/ --sort=Z_PHOT
+
+## Similar to the above, but only print rows that have a photometric
+## redshift between 2 and 3.
+$ asttable bintab.fits -cRA,DEC,/^MAG_/ --range=Z_PHOT,2:3
+
+## Similar to above, but writes the columns to a file (with metadata)
+## instead of the command-line.
 $ asttable bintab.fits -cRA,DEC,/^MAG_/ --output=out.txt
 
 ## Only print the 2nd column, and the third column multiplied by 5:
@@ -11230,13 +11637,18 @@ $ asttable plaintext.txt --output=table.fits 
--tabletype=fits-binary
 
 Table's input dataset can be given either as a file or from Standard input
 (see @ref{Standard input}). In the absence of selected columns, all the
-input's columns will be written to the output. If the specified output is a
-FITS file, the type of FITS table (binary or ASCII) will be determined from
-the @option{--tabletype} option. If the output is not a FITS file, it will
-be printed as a plain text table (with space characters between the
-columns). When the columns are accompanied by meta-data (like column name,
-units, or comments), this information will also printed in the plain text
-file before the table, as described in @ref{Gnuastro text table format}.
+input's columns and rows will be written to the output. If any output file
+is explicitly requested (with @option{--output}) the output table will be
+written in it. When no output file is explicitly requested the output table
+will be written to the standard output.
+
+If the specified output is a FITS file, the type of FITS table (binary or
+ASCII) will be determined from the @option{--tabletype} option. If the
+output is not a FITS file, it will be printed as a plain text table (with
+space characters between the columns). When the columns are accompanied by
+meta-data (like column name, units, or comments), this information will
+also printed in the plain text file before the table, as described in
+@ref{Gnuastro text table format}.
 
 For the full list of options common to all Gnuastro programs please see
 @ref{Common options}. Options can also be stored in directory, user or
@@ -11287,6 +11699,42 @@ This option is not mandatory, if no specific columns 
are requested, all the
 input table columns are output. When this option is called multiple times,
 it is possible to output one column more than once.
 
+@item -O
+@itemx --colinfoinstdout
+@cindex Standard output
+Add column metadata when the output is printed in the standard
+output. Usually the standard output is used for a fast visual check or to
+pipe into other program for further processing. So by default meta-data
+aren't included.
+
+@item -r STR,FLT:FLT
+@itemx --range=STR,FLT:FLT
+Only print the output rows that have a value within the given range in the
+@code{STR} column (can be a name or counter). For example with
+@code{--range=sn,5:20} the output's columns will only contain rows that
+have a value between 5 and 20 in the @code{sn} column (not case-sensitive).
+
+This option can be called multiple times (different ranges for different
+columns) in one run of the Table program. This is very useful for selecting
+the final rows from multiple criteria/columns.
+
+The chosen column doesn't have to be in the output columns. This is good
+when you just want to select using one column's values, but don't need that
+column anymore afterwards.
+
+@item -s STR
+@item --sort=STR
+Sort the output rows based on the values in the @code{STR} column (can be a
+column name or number). By default the sort is done in ascending/increasing
+order, to sort in a descending order, use @option{--descending}.
+
+The chosen column doesn't have to be in the output columns. This is good
+when you just want to sort using one column's values, but don't need that
+column anymore afterwards.
+
+@item -d
+@itemx --descending
+When called with @option{--sort}, rows will be sorted in descending order.
 
 @end table
 
@@ -12217,13 +12665,17 @@ to @command{minvalue}.
 @item min
 The first popped operand to this operator must be a positive integer number
 which specifies how many further operands should be popped from the
-stack. The given number of operands must have the same type and size. Each
-pixel of the output of this operator will be set to the minimum value of
-the given number of operands (images) in that pixel.
+stack. All the subsequently popped operands must have the same type and
+size. This operator (and all the variable-operand operators similar to it
+that are discussed below) will work in multi-threaded mode unless
+Arithmetic is called with the @option{--numthreads=1} option, see
+@ref{Multi-threaded operations}.
 
-For example the following command will produce an image with the same size
-and type as the inputs but each output pixel is set to the minimum
-respective pixel value of the three input images.
+Each pixel of the output of the @code{min} operator will be given the
+minimum value of the same pixel from all the popped operands/images. For
+example the following command will produce an image with the same size and
+type as the three inputs, but each output pixel value will be the minimum
+of the same pixel's values in all three input images.
 
 @example
 $ astarithmetic a.fits b.fits c.fits 3 min
@@ -12274,13 +12726,13 @@ Combine the specified number of inputs into a single 
output that contains
 the number of remaining elements after @mymath{\sigma}-clipping on each
 element/pixel (for more on @mymath{\sigma}-clipping, see @ref{Sigma
 clipping}). This operator is very similar to @command{min}, with the
-exception that it expects two operands (paramters for sigma-clipping)
+exception that it expects two operands (parameters for sigma-clipping)
 before the total number of inputs. The first popped operand is the
 termination criteria and the second is the multiple of @mymath{\sigma}.
 
 For example in the command below, the first popped operand (@command{0.2})
 is the sigma clipping termination criteria. If the termination criteria is
-larger than 1 it is interpretted as the number of clips to do. But if it is
+larger than 1 it is interpreted as the number of clips to do. But if it is
 between 0 and 1, then it is the tolerance level on the standard deviation
 (see @ref{Sigma clipping}). The second popped operand (@command{5}) is the
 multiple of sigma to use in sigma-clipping. The third popped operand
@@ -12782,7 +13234,7 @@ $ astarithmetic image.fits set-i   i i 5 gt nan where
 @end example
 
 @item tofile-AAA
-Write the top oprand on the operands stack into a file called @code{AAA}
+Write the top operand on the operands stack into a file called @code{AAA}
 (can be any FITS file name) without changing the operands stack. If you
 don't need the dataset any more and would like to free it, see the
 @code{tofilefree} operator below.
@@ -12885,7 +13337,7 @@ as a file.
 The name of the final file can be specified with the @option{--output}
 option, but if its not given, Arithmetic will use ``automatic output'' on
 the name of the first FITS image encountered to generate an output file
-name, see @ref{Automatic output}. By default, if the output file aready
+name, see @ref{Automatic output}. By default, if the output file already
 exists, it will be deleted before Arithmetic starts operation. However,
 this can be disabled with the @option{--dontdelete} option (see below). At
 any point during Arithmetic's operation, you can also write the top operand
@@ -12897,7 +13349,7 @@ dataset will be taken from the first input image (that 
contains a WCS) on
 the command-line. This can be modified with the @option{--wcsfile} and
 @option{--wcshdu} options described below. When the @option{--quiet} option
 isn't given, the name and extension of the dataset used for the output's
-WCS is printed on the commandline.
+WCS is printed on the command-line.
 
 Through operators like those starting with @code{collapse-}, the
 dimensionality of the inputs may not be the same as the outputs. By
@@ -12959,7 +13411,7 @@ file on the command-line with WCS) will be used in the 
output.
 
 This option will mostly be used when the default file (first of the set of
 inputs) is not the one containing your desired WCS. But with this option,
-you can also use Arithmetic to rewrite/chage the WCS of an existing FITS
+you can also use Arithmetic to rewrite/change the WCS of an existing FITS
 dataset from another file:
 
 @example
@@ -17412,7 +17864,7 @@ identify regions that are connected with each other. 
For example with this
 command (assuming NoiseChisel's output is called @file{nc.fits}):
 
 @example
-$ astarithmetic nc.fits connected-components -hDETECTIONS
+$ astarithmetic nc.fits 2 connected-components -hDETECTIONS
 @end example
 
 @item --rawoutput
@@ -22577,6 +23029,17 @@ redshift based on the input parameters.
 
 
 
+
+
+
+
+
+
+
+
+
+
+
 @node Library, Developing, High-level calculations, Top
 @chapter Library
 
@@ -26032,6 +26495,14 @@ same number of elements as nodes in the @code{cols} 
list. The number of
 columns that matched each input column will be stored in each element.
 @end deftypefun
 
+@deftypefun {gal_list_sizet_t *} gal_table_list_of_indexs (gal_list_str_t 
@code{*cols}, gal_data_t @code{*allcols}, size_t @code{numcols}, int 
@code{searchin}, int @code{ignorecase}, char @code{*filename}, char 
@code{*hdu}, size_t @code{*colmatch})
+Returns a list of indexs (starting from 0) of the input columns that match
+the names/numbers given to @code{cols}. This is a low-level operation which
+is called by @code{gal_table_read} (described above), see there for more on
+each argument's description. @code{allcols} is the returned array of
+@code{gal_table_info}.
+@end deftypefun
+
 @cindex Git
 @deftypefun void gal_table_comments_add_intro (gal_list_str_t 
@code{**comments}, char @code{*program_string}, time_t @code{*rawtime})
 Add some basic information to the list of @code{comments}. This basic
@@ -26167,10 +26638,13 @@ suffix doesn't have to start with `@key{.}': this 
function will return
 
 @deftypefun {char *} gal_fits_name_save_as_string (char @code{*filename}, char 
@code{*hdu})
 If the name is a FITS name, then put a @code{(hdu: ...)} after it and
-return the string. If it isn't a FITS file, just print the name. Note that
-the space is allocated. This function is useful when you want to report a
-random file to the user which may be FITS or not (for a FITS file, simply
-the filename is not enough, the HDU is also necessary).
+return the string. If it isn't a FITS file, just print the name, if
+@code{filename==NULL}, then return the string @code{stdin}. Note that the
+output string's space is allocated.
+
+This function is useful when you want to report a random file to the user
+which may be FITS or not (for a FITS file, simply the filename is not
+enough, the HDU is also necessary).
 @end deftypefun
 
 
@@ -26357,6 +26831,52 @@ spaces). This function will do this within the 
allocated space of the
 string.
 @end deftypefun
 
+@deftypefun {char *} gal_fits_key_date_to_struct_tm (char @code{*fitsdate}, 
struct tm @code{*tp})
+@cindex Date: FITS format
+Parse @code{fitsdate} as a FITS date format string (most generally:
+@code{YYYY-MM-DDThh:mm:ss.ddd...}) into the C library's broken-down time
+structure, or @code{struct tm} (declared in @file{time.h}) and return a
+pointer to the remainder of the string (containing the optional sub-second
+portion of @code{fitsdate}, or the @code{.ddd...} of the format).
+
+The returned @code{char *} points to part of the @code{fitsdate} string, so
+it must not be freed. For example, if @code{fitsdate} contains no
+sub-second portion, then the returned @code{char *} will point to the
+NULL-character of @code{fitsdate}.
+
+Note that the FITS date format mentioned above is the most complete
+representation. The following two formats are also acceptable:
+@code{YYYY-MM-DDThh:mm:ss} and @code{YYYY-MM-DD}. This option can also
+interpret the older FITS date format where only two characters are given to
+the year and the date format is reversed
+(@code{DD/MM/YYThh:mm:ss.ddd...}). In this case (following the GNU C
+Library), this option will make the following assumption: values 68 to 99
+correspond to the years 1969 to 1999, and values 0 to 68 as the years 2000
+to 2068.
+@end deftypefun
+
+@deftypefun size_t gal_fits_key_date_to_seconds (char @code{*fitsdate}, char 
@code{**subsecstr}, double @code{*subsec})
+@cindex Unix epoch time
+@cindex Epoch time, Unix
+Return the Unix epoch time (number of seconds that have passed since
+00:00:00 Thursday, January 1st, 1970) corresponding to the FITS date format
+string @code{fitsdate} (see description of
+@code{gal_fits_key_date_to_struct_tm} above).
+
+The Unix epoch time is in units of seconds, but the FITS date format allows
+sub-second accuracy. The last two arguments are for the (optional)
+sub-second portion. If @code{fitsdate} contains sub-second accuracy, then
+the starting of the sub-second part is stored in the @code{char *} pointer
+that @code{subsecstr} points to, and @code{subsec} will the corresponding
+numerical value (between 0 and 1, in double precision floating point).
+
+This is a very useful function for operations on the FITS date values, for
+example sorting FITS files by their dates, or finding the time difference
+between two FITS files. The advantage of working with the Unix epoch time
+is that you don't have to worry about calendar details (for example the
+number of days in different months, or leap years, and etc).
+@end deftypefun
+
 @deftypefun void gal_fits_key_read_from_ptr (fitsfile @code{*fptr}, gal_data_t 
@code{*keysll}, int @code{readcomment}, int @code{readunit})
 
 Read the list of keyword values from a FITS pointer. The input should be a
@@ -27056,7 +27576,7 @@ function). The first element in @code{w_h_in_pt} is the 
width and the
 second is the height of the image.
 @end deftypefun
 
-@deftypefun {void} gal_eps_write (gal_data_t @code{*in}, char 
@code{*filename}, float @code{widthincm}, uint32_t @code{borderwidth}, int 
@code{hex}, int @code{forpdf})
+@deftypefun {void} gal_eps_write (gal_data_t @code{*in}, char 
@code{*filename}, float @code{widthincm}, uint32_t @code{borderwidth}, int 
@code{hex}, int @code{dontoptimize}, int @code{forpdf})
 Write the @code{in} dataset into an EPS file called
 @code{filename}. @code{in} has to be an unsigned 8-bit character type
 (@code{GAL_TYPE_UINT8}, see @ref{Numeric data types}). The desired width of
@@ -27075,6 +27595,17 @@ encoding. To use Hexadecimal encoding, set @code{hex} 
to a non-zero
 value. Currently If you don't directly want to import the EPS file into a
 PostScript document but want to later compile it into a PDF file, set the
 @code{forpdf} argument to @code{1}.
+
+@cindex PDF
+@cindex EPS
+@cindex PostScript
+By default, when the dataset only has two values, this function will use
+the PostScript optimization that allows setting the pixel values per bit,
+not byte (@ref{Recognized file formats}). This can greatly help reduce the
+file size. However, when @option{dontoptimize!=0}, this optimization is
+disabeled: even though there are only two values (is binary), the
+difference between them does not correspond to the full contrast of black
+and white.
 @end deftypefun
 
 
@@ -27103,7 +27634,7 @@ Return @code{1} if @code{suffix} is a recognized PDF 
suffix. The recognized
 suffixes are @code{.pdf} and @code{.PDF}.
 @end deftypefun
 
-@deftypefun {void} gal_pdf_write (gal_data_t @code{*in}, char 
@code{*filename}, float @code{widthincm}, uint32_t @code{borderwidth})
+@deftypefun {void} gal_pdf_write (gal_data_t @code{*in}, char 
@code{*filename}, float @code{widthincm}, uint32_t @code{borderwidth}, int 
@code{dontoptimize})
 Write the @code{in} dataset into an EPS file called
 @code{filename}. @code{in} has to be an unsigned 8-bit character type
 (@code{GAL_TYPE_UINT8}, see @ref{Numeric data types}). The desired width of
@@ -27119,6 +27650,17 @@ EPS file to a PDF file. Therefore if GhostScript 
doesn't exist, doesn't have
 the proper version, or fails for any other reason, the EPS file will
 remain. It can be used to find the cause, or use another converter or
 PostScript compiler.
+
+@cindex PDF
+@cindex EPS
+@cindex PostScript
+By default, when the dataset only has two values, this function will use
+the PostScript optimization that allows setting the pixel values per bit,
+not byte (@ref{Recognized file formats}). This can greatly help reduce the
+file size. However, when @option{dontoptimize!=0}, this optimization is
+disabeled: even though there are only two values (is binary), the
+difference between them does not correspond to the full contrast of black
+and white.
 @end deftypefun
 
 
@@ -27235,8 +27777,9 @@ which is better considering floating point errors:
 
 @deftypefun {double *} gal_wcs_pixel_scale (struct wcsprm @code{*wcs})
 Return the pixel scale for each dimension of @code{wcs} in degrees. The
-output is an array of double precision floating point type with one element
-for each dimension.
+output is an allocated array of double precision floating point type with
+one element for each dimension. If its not successful, this function will
+return @code{NULL}.
 @end deftypefun
 
 @deftypefun double gal_wcs_pixel_area_arcsec2 (struct wcsprm @code{*wcs})
@@ -27446,8 +27989,9 @@ Multi-operand statistical operations. When 
@code{gal_arithmetic} is called
 with any of these operators, it will expect only a single operand that will
 be interpreted as a list of datasets (see @ref{List of gal_data_t}. The
 output will be a single dataset with each of its elements replaced by the
-respective statistical operation on the whole list. See the discussion
-under the @code{min} operator in @ref{Arithmetic operators}.
+respective statistical operation on the whole list. These operators can
+work on multiple threads using the @code{numthreads} argument. See the
+discussion under the @code{min} operator in @ref{Arithmetic operators}.
 @end deffn
 
 @deffn  Macro GAL_ARITHMETIC_OP_SIGCLIP_STD
@@ -27518,11 +28062,15 @@ directly use those functions.
 @end deffn
 
 
-@deftypefun {gal_data_t *} gal_arithmetic (int operator, int flags, ...)
+@deftypefun {gal_data_t *} gal_arithmetic (int @code{operator}, size_t 
@code{numthreads}, int @code{flags}, ...)
 Do the arithmetic operation of @code{operator} on the given operands (the
-third argument and any further argument). Certain special conditions can
-also be specified with the @code{flag} operator. The acceptable values for
-@code{operator} are defined in the macros above.
+third argument and any further argument). If the operator can work on
+multiple threads, the number of threads can be specified with
+@code{numthreads}. When the operator is single-threaded, @code{numthreads}
+will be ignored. Special conditions can also be specified with the
+@code{flag} operator (a bit-flag with bits described above, for example
+@code{GAL_ARITHMETIC_INPLACE} or @code{GAL_ARITHMETIC_FREE}). The
+acceptable values for @code{operator} are also defined in the macros above.
 
 @code{gal_arithmetic} is a multi-argument function (like C's
 @code{printf}). In other words, the number of necessary arguments is not
@@ -27530,9 +28078,9 @@ fixed and depends on the value to @code{operator}. Here 
are a few examples
 showing this variability:
 
 @example
-out_1=gal_arithmetic(GAL_ARITHMETIC_OP_LOG,   0, in_1);
-out_2=gal_arithmetic(GAL_ARITHMETIC_OP_PLUS,  0, in_1, in_2);
-out_3=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, 0, in_1, in_2, in_3);
+out_1=gal_arithmetic(GAL_ARITHMETIC_OP_LOG,   1, 0, in_1);
+out_2=gal_arithmetic(GAL_ARITHMETIC_OP_PLUS,  1, 0, in_1, in_2);
+out_3=gal_arithmetic(GAL_ARITHMETIC_OP_WHERE, 1, 0, in_1, in_2, in_3);
 @end example
 
 The number of necessary operands for each operator (and thus the number of
@@ -28371,13 +28919,14 @@ below.
 @deffn {Global variable} {gal_qsort_index_single}
 @cindex Thread-safety
 @cindex Multi-threaded operation
-Pointer to a floating point array (@code{float *}) to use as a reference in
-@code{gal_qsort_index_single_d} or @code{gal_qsort_index_single_i}, see the
-explanation of these functions for more. Note that if more than one array
-is to be sorted in a multi-threaded operation, the two functions will not
-work as expected. Therefore, if the operation is multi-threaded, but all
-the threads just sort the indexs based on a single array, this global
-variable can safely be used.
+Pointer to an array (for example @code{float *} or @code{int *}) to use as
+a reference in @code{gal_qsort_index_single_TYPE_d} or
+@code{gal_qsort_index_single_TYPE_i}, see the explanation of these
+functions for more. Note that if @emph{more than one} array is to be sorted
+in a multi-threaded operation, these functions will not work as
+expected. However, when all the threads just sort the indexs based on a
+@emph{single array}, this global variable can safely be used in a
+multi-threaded scenario.
 @end deffn
 
 @deftp {Type (C @code{struct})} gal_qsort_index_multi
@@ -28412,12 +28961,14 @@ types}, for example @code{gal_qsort_int32_i}, or
 @code{gal_qsort_float64_i}.
 @end deftypefun
 
-@deftypefun int gal_qsort_index_single_d (const void @code{*a}, const void 
@code{*b})
+@deftypefun int gal_qsort_index_single_TYPE_d (const void @code{*a}, const 
void @code{*b})
 When passed to @code{qsort}, this function will sort a @code{size_t} array
-based on decreasing values in the @code{gal_qsort_index_arr} single
-precision floating point array. The floating point array will not be
-changed, it is only read. For example, if we have the following source
-code:
+based on decreasing values in the @code{gal_qsort_index_single}. The global
+@code{gal_qsort_index_single} pointer has a @code{void *} pointer which
+will be cast to the proper type based on this function: for example
+@code{gal_qsort_index_single_uint16_d} will cast the array to an unsigned
+16-bit integer type. The array that @code{gal_qsort_index_single} points to
+will not be changed, it is only read. For example, see this demo program:
 
 @example
 #include <stdio.h>
@@ -28429,8 +28980,8 @@ main (void)
 @{
   size_t s[4]=@{0, 1, 2, 3@};
   float f[4]=@{1.3,0.2,1.8,0.1@};
-  gal_qsort_index_arr=f;
-  qsort(s, 4, sizeof(size_t), gal_qsort_index_single_d);
+  gal_qsort_index_single=f;
+  qsort(s, 4, sizeof(size_t), gal_qsort_index_single_float_d);
   printf("%zu, %zu, %zu, %zu\n", s[0], s[1], s[2], s[3]);
   return EXIT_SUCCESS;
 @}
@@ -28440,9 +28991,10 @@ main (void)
 The output will be: @code{2, 0, 1, 3}.
 @end deftypefun
 
-@deftypefun int gal_qsort_index_single_i (const void @code{*a}, const void 
@code{*b})
-Similar to @code{gal_qsort_index_single_d}, but will sort the indexes such
-that the values of @code{gal_qsort_index_arr} are in increasing order.
+@deftypefun int gal_qsort_index_single_TYPE_i (const void @code{*a}, const 
void @code{*b})
+Similar to @code{gal_qsort_index_single_TYPE_d}, but will sort the indexes
+such that the values of @code{gal_qsort_index_single} can be parsed in
+increasing order.
 @end deftypefun
 
 @deftypefun int gal_qsort_index_multi_d (const void @code{*a}, const void 
@code{*b})
@@ -28772,7 +29324,8 @@ plot (with a maximum of one).
 Return @code{0} if the input is not sorted, if it is sorted, this function
 will return @code{1} and @code{2} if it is increasing or decreasing,
 respectively. This function will abort with an error if @code{input} has
-zero elements. This function will only look into the dataset if the
+zero elements and will return @code{1} (sorted, increasing) when there is
+only one element. This function will only look into the dataset if the
 @code{GAL_DATA_FLAG_SORT_CH} bit of @code{input->flag} is @code{0}, see
 @ref{Generic data container}.
 
@@ -28792,7 +29345,6 @@ there are no other flags, you can simply set the flags 
to zero (with
 @example
 input->flags &= ~GAL_DATA_FLAG_SORT_CH;
 @end example
-
 @end deftypefun
 
 @deftypefun void gal_statistics_sort_increasing (gal_data_t @code{*input})
@@ -29004,7 +29556,7 @@ frequency plot (CFP, see @ref{Histogram and Cumulative 
Frequency
 Plot}). Imagine setting the horizontal axis of the input's CFP to a range
 of 0 to 100, and finding the first part where its slope is
 constantly/contiguously flat for a certain fraction/width of the whole
-dataset's range. Below we'll descibe this in more detail.
+dataset's range. Below we'll describe this in more detail.
 
 This function will first remove all the blank elements and sort the
 remaining elements. If @code{inplace} is non-zero this step will be done in
@@ -31908,7 +32460,6 @@ parenthesis. Throughout this book, they are ordered 
based on their context,
 please see the top-level contents for contextual ordering (based on what
 they do).
 
-
 @table @asis
 
 @item Arithmetic
@@ -31995,7 +32546,19 @@ projective transformation or Homography can be applied 
to the input images.
 
 @end table
 
+The programs listed above are designed to be highly modular and
+generic. Hence, they are naturally for lower-level operations. In Gnuastro,
+higher-level operations (combining multiple programs, or running a program
+in a special way), are done with installed Bash scripts (all prefixed with
+@code{astscript-}). They can be run just like a program and behave very
+similarly (with minor differences, see @ref{Installed scripts}).
 
+@table @code
+@item astscript-sort-by-night
+(See @ref{Sort FITS files by night}) Given a list of FITS files, and a HDU
+and keyword name (for a date), this script separates the files in the same
+night (possibly over two calendar days).
+@end table
 
 
 
diff --git a/doc/gnuastro.translist b/doc/gnuastro.translist
index 6bec9f7..b32d101 100644
--- a/doc/gnuastro.translist
+++ b/doc/gnuastro.translist
@@ -1,4 +1,20 @@
 <!-- begin translist file -->
+<!-- Copyright (C) 2015-2019, Free Software Foundation, Inc.
+
+ This file is part of GNU Astronomy Utilities (Gnuastro) webpage.
+
+ Gnuastro is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Gnuastro is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Gnuastro. If not, see <http://www.gnu.org/licenses/>. -->
 <!--#set var="TRANSLATION_LIST"
 value='<div id="translations">
 <p>
diff --git a/doc/javascript.html b/doc/javascript.html
index 3ac9755..b078dda 100644
--- a/doc/javascript.html
+++ b/doc/javascript.html
@@ -1,3 +1,25 @@
+<!--
+# Page for Gnuastro's Javascript license information.
+#
+# Original author:
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Contributing author(s):
+# Copyright (C) 2016-2019, Free Software Foundation, Inc.
+#
+# Gnuastro is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Gnuastro is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+-->
+
 <html>
   <body>
 
diff --git a/doc/plotsrc/README b/doc/plotsrc/README
index 37eb656..6511edf 100644
--- a/doc/plotsrc/README
+++ b/doc/plotsrc/README
@@ -1,3 +1,9 @@
+Make the plots/figures of the book
+----------------------------------
+
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 This directory has all the necessary information to make the plots
 that are to be drawn by LaTeX (TikZ) and will also convert all the
 manual images to the necessary formats for all the Texinfo output
@@ -5,4 +11,30 @@ formats.
 
 To do everything, simply run:
 
-    make
\ No newline at end of file
+    make
+
+
+
+PRACTICAL NOTES
+---------------
+
+1. When creating the final PDF files here (usually at the end of the
+boostrapping step), you might get this error:
+
+convert: attempt to perform an operation not allowed by the security policy 
`EPS' @ error/constitute.c/IsCoderAuthorized/408.
+
+If you do, go to `/etc/ImageMagick-7/policy.xml', and uncomment the line
+with the EPS,PDF,etc.... policy limitations. It was apparently due to a bug
+in Ghostscript that has been fixed since version 9.24
+(https://www.kb.cert.org/vuls/id/332928/).
+
+
+
+Copyright
+---------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt
index f3c2c65..e1762d6 100644
--- a/doc/release-checklist.txt
+++ b/doc/release-checklist.txt
@@ -1,6 +1,9 @@
 Gnuastro release checklist
 ==========================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 This file is primarily intended for the Gnuastro maintainer and lists the
 set of operations to do for making each release. This should be done after
 all the commits needed for this release have been completed.
@@ -56,9 +59,7 @@ all the commits needed for this release have been completed.
      $ git shortlog gnuastro_vP.P...HEAD --numbered --summary > ~/people.txt
      $ cat doc/announce-acknowledge.txt >> ~/people.txt
 
-     [STABLE] Clean `doc/announce-acknowledge.txt':
-     $ echo "Alphabetically ordered list to acknowledge in the next release." \
-            > doc/announce-acknowledge.txt
+     [STABLE] Remove the names in `doc/announce-acknowledge.txt'.
 
 
  - [STABLE] Correct the version links in the webpage
@@ -75,6 +76,7 @@ all the commits needed for this release have been completed.
  - Update Gnulib and Autoconf archives, then remove all the non-version
    controlled files and bootstrap Gnuastro:
 
+     $ git clean -fxd
      $ ./bootstrap --copy --gnulib-srcdir=/path/to/updated/gnulib
 
 
@@ -196,6 +198,8 @@ all the commits needed for this release have been completed.
 
 
 
+
+
 Packaging in Debian
 ===================
 
@@ -400,3 +404,21 @@ Steps necessary to Package Gnuastro for Debian.
 
  - Inform Debian Astro: Ole Streicher (olebole@debian.org) has been
    uploading Gnuastro to Debian until now.
+
+
+
+
+
+
+
+
+
+
+Copyright
+=========
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index aba3df2..dfdfabb 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -32,6 +32,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <gnuastro/blank.h>
 #include <gnuastro/qsort.h>
 #include <gnuastro/pointer.h>
+#include <gnuastro/threads.h>
 #include <gnuastro/dimension.h>
 #include <gnuastro/statistics.h>
 #include <gnuastro/arithmetic.h>
@@ -669,27 +670,45 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 /***********************************************************************/
 /***************        Multiple operand operators        **************/
 /***********************************************************************/
+struct multioperandparams
+{
+  gal_data_t      *list;        /* List of input datasets.           */
+  gal_data_t       *out;        /* Output dataset.                   */
+  size_t           dnum;        /* Number of input dataset.          */
+  int          operator;        /* Operator to use.                  */
+  uint8_t     *hasblank;        /* Array of 0s or 1s for each input. */
+  float              p1;        /* Sigma-cliping parameter 1.        */
+  float              p2;        /* Sigma-cliping parameter 2.        */
+};
+
+
+
+
+
 #define MULTIOPERAND_MIN(TYPE) {                                        \
-    TYPE p, max;                                                        \
+    TYPE t, max;                                                        \
     size_t n, j=0;                                                      \
-    gal_type_max(list->type, &max);                                     \
-    do    /* Loop over each pixel */                                    \
+    gal_type_max(p->list->type, &max);                                  \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
-        p=max;                                                          \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        t=max;                                                          \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {   /* Only for integer types, b==b. */                       \
-            if( hasblank[i] && b==b)                                    \
+            if( p->hasblank[i] && b==b)                                 \
               {                                                         \
                 if( a[i][j] != b )                                      \
-                  { p = a[i][j] < p ? a[i][j] : p; ++n; }               \
+                  { t = a[i][j] < t ? a[i][j] : t; ++n; }               \
               }                                                         \
-            else { p = a[i][j] < p ? a[i][j] : p; ++n; }                \
+            else { t = a[i][j] < t ? a[i][j] : t; ++n; }                \
           }                                                             \
-        *o++ = n ? p : b;  /* No usable elements: set to blank. */      \
-        ++j;                                                            \
+        o[j] = n ? t : b;  /* No usable elements: set to blank. */      \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -697,26 +716,29 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 
 #define MULTIOPERAND_MAX(TYPE) {                                        \
-    TYPE p, min;                                                        \
+    TYPE t, min;                                                        \
     size_t n, j=0;                                                      \
-    gal_type_min(list->type, &min);                                     \
-    do    /* Loop over each pixel */                                    \
+    gal_type_min(p->list->type, &min);                                  \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
-        p=min;                                                          \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        t=min;                                                          \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {   /* Only for integer types, b==b. */                       \
-            if( hasblank[i] && b==b)                                    \
+            if( p->hasblank[i] && b==b)                                 \
               {                                                         \
                 if( a[i][j] != b )                                      \
-                  { p = a[i][j] > p ? a[i][j] : p; ++n; }               \
+                  { t = a[i][j] > t ? a[i][j] : t; ++n; }               \
               }                                                         \
-            else { p = a[i][j] > p ? a[i][j] : p; ++n; }                \
+            else { t = a[i][j] > t ? a[i][j] : t; ++n; }                \
           }                                                             \
-        *o++ = n ? p : b;  /* No usable elements: set to blank. */      \
-        ++j;                                                            \
+        o[j] = n ? t : b;  /* No usable elements: set to blank. */      \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -725,14 +747,19 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 #define MULTIOPERAND_NUM {                                              \
     int use;                                                            \
-    size_t n, j=0;                                                      \
-    do    /* Loop over each pixel */                                    \
+    size_t n, j;                                                        \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
             /* Only integers and non-NaN floats: v==v is 1. */          \
-            if(hasblank[i])                                             \
+            if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )      /* Integer */ \
                       : ( a[i][j]==a[i][j] ? 1 : 0 ) );   /* Float   */ \
@@ -741,10 +768,8 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
             /* Increment counter if necessary. */                       \
             if(use) ++n;                                                \
           }                                                             \
-        *o++ = n;                                                       \
-        ++j;                                                            \
+        o[j] = n;                                                       \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -754,15 +779,20 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 #define MULTIOPERAND_SUM {                                              \
     int use;                                                            \
     double sum;                                                         \
-    size_t n, j=0;                                                      \
-    do    /* Loop over each pixel */                                    \
+    size_t n, j;                                                        \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
         sum=0.0f;                                                       \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
             /* Only integers and non-NaN floats: v==v is 1. */          \
-            if(hasblank[i])                                             \
+            if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b     ? 1 : 0 )       /* Integer */  \
                       : ( a[i][j]==*a[i] ? 1 : 0 ) );    /* Float   */  \
@@ -771,10 +801,8 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
             /* Use in sum if necessary. */                              \
             if(use) { sum += a[i][j]; ++n; }                            \
           }                                                             \
-        *o++ = n ? sum : b;                                             \
-        ++j;                                                            \
+        o[j] = n ? sum : b;                                             \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -784,15 +812,20 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 #define MULTIOPERAND_MEAN {                                             \
     int use;                                                            \
     double sum;                                                         \
-    size_t n, j=0;                                                      \
-    do    /* Loop over each pixel */                                    \
+    size_t n, j;                                                        \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
         sum=0.0f;                                                       \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
             /* Only integers and non-NaN floats: v==v is 1. */          \
-            if(hasblank[i])                                             \
+            if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
                       : ( a[i][j]==a[i][j] ? 1 : 0 ) );  /* Float   */  \
@@ -801,10 +834,8 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
             /* Calculate the mean if necessary. */                      \
             if(use) { sum += a[i][j]; ++n; }                            \
           }                                                             \
-        *o++ = n ? sum/n : b;                                           \
-        ++j;                                                            \
+        o[j] = n ? sum/n : b;                                           \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -813,16 +844,21 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 #define MULTIOPERAND_STD {                                              \
     int use;                                                            \
-    size_t n, j=0;                                                      \
+    size_t n, j;                                                        \
     double sum, sum2;                                                   \
-    do    /* Loop over each pixel */                                    \
+                                                                        \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
         sum=sum2=0.0f;                                                  \
-        for(i=0;i<dnum;++i)  /* Loop over each array. */                \
+        j=tprm->indexs[tind];                                           \
+                                                                        \
+        for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
             /* Only integers and non-NaN floats: v==v is 1. */          \
-            if(hasblank[i])                                             \
+            if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
                       : ( a[i][j]==a[i][j] ? 1 : 0 ) );  /* Float   */  \
@@ -836,10 +872,8 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
                 ++n;                                                    \
               }                                                         \
           }                                                             \
-        *o++ = n ? sqrt( (sum2-sum*sum/n)/n ) : b;                      \
-        ++j;                                                            \
+        o[j] = n ? sqrt( (sum2-sum*sum/n)/n ) : b;                      \
       }                                                                 \
-    while(o<of);                                                        \
   }
 
 
@@ -848,21 +882,22 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 #define MULTIOPERAND_MEDIAN(TYPE, QSORT_F) {                            \
     int use;                                                            \
-    size_t n, j=0;                                                      \
-    TYPE *pixs=gal_pointer_allocate(list->type, dnum, 0, __func__,      \
-                                    "pixs");                            \
+    size_t n, j;                                                        \
+    TYPE *pixs=gal_pointer_allocate(p->list->type, p->dnum, 0,          \
+                                    __func__, "pixs");                  \
                                                                         \
-    /* Loop over each pixel */                                          \
-    do                                                                  \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
-        /* Initialize. */                                               \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
+        j=tprm->indexs[tind];                                           \
                                                                         \
-        /* Loop over each array. */                                     \
-        for(i=0;i<dnum;++i)                                             \
+        /* Loop over each array: `i' is input dataset's index. */       \
+        for(i=0;i<p->dnum;++i)                                          \
           {                                                             \
             /* Only integers and non-NaN floats: v==v is 1. */          \
-            if(hasblank[i])                                             \
+            if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
                       : ( a[i][j]==a[i][j] ? 1 : 0 ) );  /* Float   */  \
@@ -876,13 +911,11 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
         if(n)                                                           \
           {                                                             \
             qsort(pixs, n, sizeof *pixs, QSORT_F);                      \
-            *o++ = n%2 ? pixs[n/2] : (pixs[n/2] + pixs[n/2-1])/2 ;      \
+            o[j] = n%2 ? pixs[n/2] : (pixs[n/2] + pixs[n/2-1])/2 ;      \
           }                                                             \
         else                                                            \
-          *o++=b;                                                       \
-        ++j;                                                            \
+          o[j]=b;                                                       \
       }                                                                 \
-    while(o<of);                                                        \
                                                                         \
     /* Clean up. */                                                     \
     free(pixs);                                                         \
@@ -894,49 +927,48 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 #define MULTIOPERAND_SIGCLIP(TYPE) {                                    \
     float *sarr;                                                        \
-    size_t n, j=0;                                                      \
+    size_t n, j;                                                        \
     gal_data_t *sclip;                                                  \
-    TYPE *pixs=gal_pointer_allocate(list->type, dnum, 0, __func__,      \
-                                    "pixs");                            \
-    gal_data_t *cont=gal_data_alloc(pixs, list->type, 1, &dnum, NULL,   \
-                                    0, -1, NULL, NULL, NULL);           \
+    TYPE *pixs=gal_pointer_allocate(p->list->type, p->dnum, 0,          \
+                                    __func__, "pixs");                  \
+    gal_data_t *cont=gal_data_alloc(pixs, p->list->type, 1, &p->dnum,   \
+                                    NULL, 0, -1, NULL, NULL, NULL);     \
                                                                         \
-    /* Loop over each pixel */                                          \
-    do                                                                  \
+    /* Go over all the pixels assigned to this thread. */               \
+    for(tind=0; tprm->indexs[tind] != GAL_BLANK_SIZE_T; ++tind)         \
       {                                                                 \
-        /* Initialize. */                                               \
+        /* Initialize, `j' is desired pixel's index. */                 \
         n=0;                                                            \
+        j=tprm->indexs[tind];                                           \
                                                                         \
-        /* Loop over each array. */                                     \
-        for(i=0;i<dnum;++i) pixs[n++]=a[i][j];                          \
+        /* Read the necessay values from each input. */                 \
+        for(i=0;i<p->dnum;++i) pixs[n++]=a[i][j];                       \
                                                                         \
         /* If there are any elements, measure the  */                   \
         if(n)                                                           \
           {                                                             \
-            sclip=gal_statistics_sigma_clip(cont, p1, p2, 1, 1);        \
+            sclip=gal_statistics_sigma_clip(cont, p->p1, p->p2, 1, 1);  \
             sarr=sclip->array;                                          \
-            switch(operator)                                            \
+            switch(p->operator)                                         \
               {                                                         \
-              case GAL_ARITHMETIC_OP_SIGCLIP_STD:    *o++=sarr[3]; break;\
-              case GAL_ARITHMETIC_OP_SIGCLIP_MEAN:   *o++=sarr[2]; break;\
-              case GAL_ARITHMETIC_OP_SIGCLIP_MEDIAN: *o++=sarr[1]; break;\
-              case GAL_ARITHMETIC_OP_SIGCLIP_NUMBER: *o++=sarr[0]; break;\
+              case GAL_ARITHMETIC_OP_SIGCLIP_STD:    o[j]=sarr[3]; break;\
+              case GAL_ARITHMETIC_OP_SIGCLIP_MEAN:   o[j]=sarr[2]; break;\
+              case GAL_ARITHMETIC_OP_SIGCLIP_MEDIAN: o[j]=sarr[1]; break;\
+              case GAL_ARITHMETIC_OP_SIGCLIP_NUMBER: o[j]=sarr[0]; break;\
               default:                                                  \
                 error(EXIT_FAILURE, 0, "%s: a bug! the code %d is not " \
                       "valid for sigma-clipping results", __func__,     \
-                      operator);                                        \
+                      p->operator);                                     \
               }                                                         \
                                                                         \
             /* Since we are doing sigma-clipping in place, the size, */ \
             /* and flags need to be reset. */                           \
             cont->flag=0;                                               \
-            cont->size=cont->dsize[0]=dnum;                             \
+            cont->size=cont->dsize[0]=p->dnum;                          \
           }                                                             \
         else                                                            \
-          *o++=b;                                                       \
-        ++j;                                                            \
+          o[j]=b;                                                       \
       }                                                                 \
-    while(o<of);                                                        \
                                                                         \
     /* Clean up. */                                                     \
     gal_data_free(cont);                                                \
@@ -947,25 +979,26 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 
 #define MULTIOPERAND_TYPE_SET(TYPE, QSORT_F) {                          \
-    TYPE b, **a, *o=out->array, *of=o+out->size;                        \
-    size_t i=0;  /* Different from the `i' in the main function. */     \
+    gal_data_t *tmp;                                                    \
+    size_t i=0, tind;                                                   \
+    TYPE b, **a, *o=p->out->array;                                      \
                                                                         \
     /* Allocate space to keep the pointers to the arrays of each. */    \
     /* Input data structure. The operators will increment these */      \
     /* pointers while parsing them. */                                  \
     errno=0;                                                            \
-    a=malloc(dnum*sizeof *a);                                           \
+    a=malloc(p->dnum*sizeof *a);                                        \
     if(a==NULL)                                                         \
       error(EXIT_FAILURE, 0, "%s: %zu bytes for `a'",                   \
-            "MULTIOPERAND_TYPE_SET", dnum*sizeof *a);                   \
+            "MULTIOPERAND_TYPE_SET", p->dnum*sizeof *a);                \
                                                                         \
     /* Fill in the array pointers and the blank value for this type. */ \
-    gal_blank_write(&b, list->type);                                    \
-    for(tmp=list;tmp!=NULL;tmp=tmp->next)                               \
+    gal_blank_write(&b, p->list->type);                                 \
+    for(tmp=p->list;tmp!=NULL;tmp=tmp->next)                            \
       a[i++]=tmp->array;                                                \
                                                                         \
     /* Do the operation. */                                             \
-    switch(operator)                                                    \
+    switch(p->operator)                                                 \
       {                                                                 \
       case GAL_ARITHMETIC_OP_MIN:                                       \
         MULTIOPERAND_MIN(TYPE);                                         \
@@ -1004,7 +1037,7 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
                                                                         \
       default:                                                          \
         error(EXIT_FAILURE, 0, "%s: operator code %d not recognized",   \
-              "MULTIOPERAND_TYPE_SET", operator);                       \
+              "MULTIOPERAND_TYPE_SET", p->operator);                    \
       }                                                                 \
                                                                         \
     /* Clean up. */                                                     \
@@ -1015,16 +1048,72 @@ arithmetic_where(int flags, gal_data_t *out, gal_data_t 
*cond,
 
 
 
+/* Worker function on each thread. */
+void *
+multioperand_on_thread(void *in_prm)
+{
+  /* Low-level definitions to be done first. */
+  struct gal_threads_params *tprm=(struct gal_threads_params *)in_prm;
+  struct multioperandparams *p=(struct multioperandparams *)tprm->params;
+
+  /* Do the operation on each thread. */
+  switch(p->list->type)
+    {
+    case GAL_TYPE_UINT8:
+      MULTIOPERAND_TYPE_SET(uint8_t,   gal_qsort_uint8_i);
+      break;
+    case GAL_TYPE_INT8:
+      MULTIOPERAND_TYPE_SET(int8_t,    gal_qsort_int8_i);
+      break;
+    case GAL_TYPE_UINT16:
+      MULTIOPERAND_TYPE_SET(uint16_t,  gal_qsort_uint16_i);
+      break;
+    case GAL_TYPE_INT16:
+      MULTIOPERAND_TYPE_SET(int16_t,   gal_qsort_int16_i);
+      break;
+    case GAL_TYPE_UINT32:
+      MULTIOPERAND_TYPE_SET(uint32_t,  gal_qsort_uint32_i);
+      break;
+    case GAL_TYPE_INT32:
+      MULTIOPERAND_TYPE_SET(int32_t,   gal_qsort_int32_i);
+      break;
+    case GAL_TYPE_UINT64:
+      MULTIOPERAND_TYPE_SET(uint64_t,  gal_qsort_uint64_i);
+      break;
+    case GAL_TYPE_INT64:
+      MULTIOPERAND_TYPE_SET(int64_t,   gal_qsort_int64_i);
+      break;
+    case GAL_TYPE_FLOAT32:
+      MULTIOPERAND_TYPE_SET(float,     gal_qsort_float32_i);
+      break;
+    case GAL_TYPE_FLOAT64:
+      MULTIOPERAND_TYPE_SET(double,    gal_qsort_float64_i);
+      break;
+    default:
+      error(EXIT_FAILURE, 0, "%s: type code %d not recognized",
+            __func__, p->list->type);
+    }
+
+  /* Wait for all the other threads to finish, then return. */
+  if(tprm->b) pthread_barrier_wait(tprm->b);
+  return NULL;
+}
+
+
+
+
+
 /* The single operator in this function is assumed to be a linked list. The
    number of operators is determined from the fact that the last node in
    the linked list must have a NULL pointer as its `next' element. */
 static gal_data_t *
 arithmetic_multioperand(int operator, int flags, gal_data_t *list,
-                        gal_data_t *params)
+                        gal_data_t *params, size_t numthreads)
 {
   uint8_t *hasblank;
   size_t i=0, dnum=1;
   float p1=NAN, p2=NAN;
+  struct multioperandparams p;
   gal_data_t *out, *tmp, *ttmp;
 
 
@@ -1087,43 +1176,16 @@ arithmetic_multioperand(int operator, int flags, 
gal_data_t *list,
     hasblank[i++]=gal_blank_present(tmp, 0);
 
 
-  /* Start the operation. */
-  switch(list->type)
-    {
-    case GAL_TYPE_UINT8:
-      MULTIOPERAND_TYPE_SET(uint8_t,   gal_qsort_uint8_i);
-      break;
-    case GAL_TYPE_INT8:
-      MULTIOPERAND_TYPE_SET(int8_t,    gal_qsort_int8_i);
-      break;
-    case GAL_TYPE_UINT16:
-      MULTIOPERAND_TYPE_SET(uint16_t,  gal_qsort_uint16_i);
-      break;
-    case GAL_TYPE_INT16:
-      MULTIOPERAND_TYPE_SET(int16_t,   gal_qsort_int16_i);
-      break;
-    case GAL_TYPE_UINT32:
-      MULTIOPERAND_TYPE_SET(uint32_t,  gal_qsort_uint32_i);
-      break;
-    case GAL_TYPE_INT32:
-      MULTIOPERAND_TYPE_SET(int32_t,   gal_qsort_int32_i);
-      break;
-    case GAL_TYPE_UINT64:
-      MULTIOPERAND_TYPE_SET(uint64_t,  gal_qsort_uint64_i);
-      break;
-    case GAL_TYPE_INT64:
-      MULTIOPERAND_TYPE_SET(int64_t,   gal_qsort_int64_i);
-      break;
-    case GAL_TYPE_FLOAT32:
-      MULTIOPERAND_TYPE_SET(float,     gal_qsort_float32_i);
-      break;
-    case GAL_TYPE_FLOAT64:
-      MULTIOPERAND_TYPE_SET(double,    gal_qsort_float64_i);
-      break;
-    default:
-      error(EXIT_FAILURE, 0, "%s: type code %d not recognized",
-            __func__, list->type);
-    }
+  /* Set the parameters necessary for multithreaded operation and spin them
+     off to do apply the operator. */
+  p.p1=p1;
+  p.p2=p2;
+  p.out=out;
+  p.list=list;
+  p.dnum=dnum;
+  p.operator=operator;
+  p.hasblank=hasblank;
+  gal_threads_spin_off(multioperand_on_thread, &p, out->size, numthreads);
 
 
   /* Clean up and return. Note that the operation might have been done in
@@ -1551,7 +1613,7 @@ gal_arithmetic_operator_string(int operator)
 
 
 gal_data_t *
-gal_arithmetic(int operator, int flags, ...)
+gal_arithmetic(int operator, size_t numthreads, int flags, ...)
 {
   va_list va;
   gal_data_t *d1, *d2, *d3, *out=NULL;
@@ -1641,7 +1703,7 @@ gal_arithmetic(int operator, int flags, ...)
     case GAL_ARITHMETIC_OP_SIGCLIP_NUMBER:
       d1 = va_arg(va, gal_data_t *);
       d2 = va_arg(va, gal_data_t *);
-      out=arithmetic_multioperand(operator, flags, d1, d2);
+      out=arithmetic_multioperand(operator, flags, d1, d2, numthreads);
       break;
 
 
diff --git a/lib/eps.c b/lib/eps.c
index b787d5e..997fc09 100644
--- a/lib/eps.c
+++ b/lib/eps.c
@@ -290,7 +290,7 @@ eps_write_ascii85(gal_data_t *write, FILE *fp, size_t 
numbytes)
 
 
 static void
-eps_write_image(gal_data_t *in, FILE *fp, int hex)
+eps_write_image(gal_data_t *in, FILE *fp, int hex, int dontoptimize)
 {
   int bpc=8;
   uint8_t bitone;
@@ -299,7 +299,7 @@ eps_write_image(gal_data_t *in, FILE *fp, int hex)
   size_t numch=gal_list_data_number(in);
 
   /* Set the number of bits per component. */
-  if( numch==1 && eps_is_binary(in, &bitone) )
+  if( numch==1 && dontoptimize==0 && eps_is_binary(in, &bitone) )
     {
       bpc=1;
       write=eps_convert_to_bitstream(in, &numbytes, bitone);
@@ -366,7 +366,7 @@ gal_eps_to_pt(float widthincm, size_t *dsize, size_t 
*w_h_in_pt)
 
 void
 gal_eps_write(gal_data_t *in, char *filename, float widthincm,
-              uint32_t borderwidth, int hex, int forpdf)
+              uint32_t borderwidth, int hex, int dontoptimize, int forpdf)
 {
   FILE *fp;
   float hbw;
@@ -427,7 +427,7 @@ gal_eps_write(gal_data_t *in, char *filename, float 
widthincm,
   fprintf(fp, "%% Draw the image:\n");
   fprintf(fp, "%d %d translate\n", borderwidth, borderwidth);
   fprintf(fp, "%zu %zu scale\n", w_h_in_pt[0], w_h_in_pt[1]);
-  eps_write_image(in, fp, hex);
+  eps_write_image(in, fp, hex, dontoptimize);
 
 
   /* Ending of the EPS file: */
diff --git a/lib/fits.c b/lib/fits.c
index 994a619..dd2d3bf 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -147,12 +147,19 @@ char *
 gal_fits_name_save_as_string(char *filename, char *hdu)
 {
   char *name;
-  if( gal_fits_name_is_fits(filename) )
+
+  /* Small sanity check. */
+  if(filename==NULL)
+    gal_checkset_allocate_copy("stdin", &name);
+  else
     {
-      if( asprintf(&name, "%s (hdu: %s)", filename, hdu)<0 )
-        error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
+      if( gal_fits_name_is_fits(filename) )
+        {
+          if( asprintf(&name, "%s (hdu: %s)", filename, hdu)<0 )
+            error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
+        }
+      else gal_checkset_allocate_copy(filename, &name);
     }
-  else gal_checkset_allocate_copy(filename, &name);
   return name;
 }
 
@@ -885,6 +892,118 @@ gal_fits_key_clean_str_value(char *string)
 
 
 
+/* Fill the `tm' structure (defined in `time.h') with the values derived
+   from a FITS format date-string and return the (optional) sub-second
+   information as a double.*/
+char *
+gal_fits_key_date_to_struct_tm(char *fitsdate, struct tm *tp)
+{
+  char *c=NULL, *cf;
+  int hasT=0, hassq=0, usesdash=0, usesslash=0;
+
+  /* Initialize the `tm' structure to all-zero elements. In particular, The
+     FITS standard times are written in UTC, so, the time zone (`tm_zone'
+     element, which specifies number of seconds to shift for the time zone)
+     has to be zero. The day-light saving flag (`isdst' element) also has
+     to be set to zero. */
+  tp->tm_sec=tp->tm_min=tp->tm_hour=tp->tm_mday=tp->tm_mon=tp->tm_year=0;
+  tp->tm_wday=tp->tm_yday=tp->tm_isdst=tp->tm_gmtoff;
+  tp->tm_zone=NULL;
+
+  /* According to the FITS standard the `T' in the middle of the date and
+     time of day is optional (the time is not mandatory). */
+  cf=(c=fitsdate)+strlen(fitsdate);
+  do
+    switch(*c)
+      {
+      case 'T':  hasT=1;      break; /* With `T' HH:MM:SS are defined.    */
+      case '-':  usesdash=1;  break; /* Day definition: YYYY-MM-DD.       */
+      case '/':  usesslash=1; break; /* Day definition(old): DD/MM/YY.    */
+      case '\'': hassq=1;     break; /* Wholly Wrapped in a single-quote. */
+      }
+  while(++c<cf);
+
+  /* Convert this date into seconds since 1970/01/01, 00:00:00. */
+  c = ( (usesdash==0 && usesslash==0)
+        ? NULL
+        : ( usesdash
+            ? ( hasT
+                ? strptime(fitsdate, hassq?"'%FT%T'":"%FT%T", tp)
+                : strptime(fitsdate, hassq?"'%F'"   :"%F"   , tp))
+            : ( hasT
+                ? strptime(fitsdate, hassq?"'%d/%m/%yT%T'":"%d/%m/%yT%T", tp)
+                : strptime(fitsdate, hassq?"'%d/%m/%y'"   :"%d/%m/%y"   , tp)
+                )
+            )
+        );
+
+  /* The value might have sub-seconds. In that case, `c' will point to a
+     `.' and we'll have to parse it as double. */
+  if( c==NULL || (*c!='.' && *c!='\0') )
+    error(EXIT_FAILURE, 0, "`%s' isn't in the FITS date format.\n\n"
+          "According to the FITS standard, the date must be in one of "
+          "these formats:\n"
+          "   YYYY-MM-DD\n"
+          "   YYYY-MM-DDThh:mm:ss\n"
+          "   DD/MM/YY               (Note the `YY', see *)\n"
+          "   DD/MM/YYThh:mm:ss      (Note the `YY', see *)\n\n"
+          "[*]: Gnuastro's FITS library (this program), interprets the "
+          "older (two character for year) format, year values 68 to 99 as "
+          "the years 1969 to 1999 and values 0 to 68 as the years 2000 to "
+          "2068.", fitsdate);
+
+  /* Return the subsecond value. */
+  return c;
+}
+
+
+
+
+
+/* Convert the FITS standard date format (as a string, already read from
+   the keywords) into number of seconds since 1970/01/01, 00:00:00. Very
+   useful to avoid calendar issues like number of days in a different
+   months or leap years and etc. The remainder of the format string
+   (sub-seconds) will be put into the two pointer arguments: `subsec' is in
+   double-precision floating point format and  */
+size_t
+gal_fits_key_date_to_seconds(char *fitsdate, char **subsecstr,
+                             double *subsec)
+{
+  time_t t;
+  char *tmp;
+  struct tm tp;
+  void *outptr=subsec;
+
+  /* Fill in the `tp' elements with values read from the string. */
+  tmp=gal_fits_key_date_to_struct_tm(fitsdate, &tp);
+
+  /* If the user cared about the remainder (sub-second string), then set it
+     and convert it to a double type. */
+  if(subsecstr)
+    {
+      /* Set the output pointer. */
+      *subsecstr=tmp;
+
+      /* Convert the remainder string to double-precision floating point
+         (if the given pointer isn't NULL). */
+      if(subsec)
+        if( gal_type_from_string(&outptr, tmp, GAL_TYPE_FLOAT64) )
+          error(EXIT_FAILURE, 0, "%s: the sub-second portion of `%s' (or "
+                "`%s') couldn't be read as a number", __func__, fitsdate,
+                tmp);
+    }
+
+  /* Convert the `tm' structure to `time_t'. */
+  t=mktime(&tp);
+
+  /* Return the value and set the output pointer. */
+  return (size_t)t;
+}
+
+
+
+
 
 /* Read the keyword values from a FITS pointer. The input should be a
    linked list of `gal_data_t'. Before calling this function, you just have
@@ -1973,9 +2092,12 @@ gal_fits_img_write_to_ptr(gal_data_t *input, char 
*filename)
       /* Convert the WCS information to text. */
       status=wcshdo(WCSHDO_safe, towrite->wcs, &nkeyrec, &wcsstr);
       if(status)
-        error(EXIT_FAILURE, 0, "%s: wcshdo ERROR %d: %s", __func__,
-              status, wcs_errmsg[status]);
-      gal_fits_key_write_wcsstr(fptr, wcsstr, nkeyrec);
+        error(0, 0, "%s: WARNING: WCSLIB error, no WCS in output.\n"
+              "wcshdu ERROR %d: %s", __func__, status,
+              wcs_errmsg[status]);
+      else
+        gal_fits_key_write_wcsstr(fptr, wcsstr, nkeyrec);
+      status=0;
     }
 
   /* Report any errors if we had any */
diff --git a/lib/gnuastro-internal/README b/lib/gnuastro-internal/README
index d9c87b9..a4e26f2 100644
--- a/lib/gnuastro-internal/README
+++ b/lib/gnuastro-internal/README
@@ -1,9 +1,25 @@
 GNU Astronomy Utilities internal header files
 ---------------------------------------------
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 The `.h' files in this directory are headers to Gnuastro's internal
 libraries: libraries that are only available to Gnuastro's programs. These
 are functions that are mainly to do with running a program, for example the
 common options to all the programs, functions to manage options and
 configuration files, timing and etc (the names are hopefully descriptive
-enough).
\ No newline at end of file
+enough).
+
+
+
+
+
+Copyright
+---------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
\ No newline at end of file
diff --git a/lib/gnuastro-internal/options.h b/lib/gnuastro-internal/options.h
index 3ba3da8..61f70e8 100644
--- a/lib/gnuastro-internal/options.h
+++ b/lib/gnuastro-internal/options.h
@@ -305,6 +305,10 @@ void *
 gal_options_read_sigma_clip(struct argp_option *option, char *arg,
                             char *filename, size_t lineno, void *junk);
 
+void *
+gal_options_parse_name_and_values(struct argp_option *option, char *arg,
+                                  char *filename, size_t lineno, void *junk);
+
 
 /**********************************************************************/
 /************            Command-line options           ***************/
diff --git a/lib/gnuastro.pc.in b/lib/gnuastro.pc.in
index 8607e88..3223d8f 100644
--- a/lib/gnuastro.pc.in
+++ b/lib/gnuastro.pc.in
@@ -1,3 +1,23 @@
+# pkg-config settings for Gnuastro's library.
+#
+# Original author:
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Contributing author(s):
+# Copyright (C) 2015-2019, Free Software Foundation, Inc.
+#
+# Gnuastro is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Gnuastro is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
diff --git a/lib/gnuastro/README b/lib/gnuastro/README
index dab1dcf..8dec4c3 100644
--- a/lib/gnuastro/README
+++ b/lib/gnuastro/README
@@ -1,6 +1,9 @@
 GNU Astronomy Utilities library header files
 ============================================
 
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
 This directory contins Gnuastro's installed library header files. Once
 installed, these headers will be installed in the specified
 '$(prefix)/include/gnuastro' directory (the value of '$(prefix)' can be set
@@ -11,4 +14,17 @@ Inside of Gnuastro, the directory is given the same name to 
make Gnuastro's
 internal code similar to what a user would use in their own programs once
 the header files are installed. The headers that are not installed are kept
 in the parent directory of this directory mixed with the actual library
-`.c' source files.
\ No newline at end of file
+`.c' source files.
+
+
+
+
+
+Copyright
+---------
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document under
+the terms of the GNU Free Documentation License, Version 1.3 or any later
+version published by the Free Software Foundation; with no Invariant
+Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
diff --git a/lib/gnuastro/arithmetic.h b/lib/gnuastro/arithmetic.h
index db65bc8..a1922c8 100644
--- a/lib/gnuastro/arithmetic.h
+++ b/lib/gnuastro/arithmetic.h
@@ -143,7 +143,7 @@ enum gal_arithmetic_operators
 
 
 gal_data_t *
-gal_arithmetic(int operator, int flags, ...);
+gal_arithmetic(int operator, size_t numthreads, int flags, ...);
 
 
 
diff --git a/lib/gnuastro/eps.h b/lib/gnuastro/eps.h
index f2a6d3f..4026bde 100644
--- a/lib/gnuastro/eps.h
+++ b/lib/gnuastro/eps.h
@@ -65,7 +65,7 @@ gal_eps_to_pt(float widthincm, size_t *dsize, size_t 
*w_h_in_pt);
 
 void
 gal_eps_write(gal_data_t *in, char *filename, float widthincm,
-              uint32_t borderwidth, int hex, int forpdf);
+              uint32_t borderwidth, int hex, int dontoptimize, int forpdf);
 
 
 
diff --git a/lib/gnuastro/fits.h b/lib/gnuastro/fits.h
index 3816b39..9071294 100644
--- a/lib/gnuastro/fits.h
+++ b/lib/gnuastro/fits.h
@@ -37,6 +37,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /* Include other headers if necessary here. Note that other header files
    must be included before the C++ preparations below */
 #include <math.h>
+#include <time.h>
 #include <float.h>
 
 #include <fitsio.h>
@@ -166,6 +167,13 @@ gal_fits_key_img_blank(uint8_t type);
 void
 gal_fits_key_clean_str_value(char *string);
 
+char *
+gal_fits_key_date_to_struct_tm(char *fitsdate, struct tm *tp);
+
+size_t
+gal_fits_key_date_to_seconds(char *fitsdate, char **subsecstr,
+                             double *subsec);
+
 void
 gal_fits_key_read_from_ptr(fitsfile *fptr, gal_data_t *keysll,
                            int readcomment, int readunit);
diff --git a/lib/gnuastro/pdf.h b/lib/gnuastro/pdf.h
index 1987127..5ca76c4 100644
--- a/lib/gnuastro/pdf.h
+++ b/lib/gnuastro/pdf.h
@@ -62,7 +62,7 @@ gal_pdf_suffix_is_pdf(char *name);
 
 void
 gal_pdf_write(gal_data_t *in, char *filename, float widthincm,
-              uint32_t borderwidth);
+              uint32_t borderwidth, int dontoptimize);
 
 
 
diff --git a/lib/gnuastro/qsort.h b/lib/gnuastro/qsort.h
index 2437b95..f7bd374 100644
--- a/lib/gnuastro/qsort.h
+++ b/lib/gnuastro/qsort.h
@@ -123,7 +123,7 @@ gal_qsort_float64_i(const void *a, const void *b);
 /* Pointer used to sort the indexs of an array based on their flux (value
    in this array). Note: when EACH THREAD USES A DIFFERENT ARRAY, this is
    not thread-safe . */
-extern float *gal_qsort_index_single;
+extern void *gal_qsort_index_single;
 
 
 /* When each thread is working on a different array, we'll need to keep the
@@ -136,10 +136,64 @@ struct gal_qsort_index_multi
 };
 
 int
-gal_qsort_index_single_d(const void *a, const void *b);
+gal_qsort_index_single_uint8_d(const void *a, const void *b);
 
 int
-gal_qsort_index_single_i(const void *a, const void *b);
+gal_qsort_index_single_uint8_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int8_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int8_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint16_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint16_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int16_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int16_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint32_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint32_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int32_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int32_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint64_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_uint64_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int64_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_int64_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_float32_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_float32_i(const void *a, const void *b);
+
+int
+gal_qsort_index_single_float64_d(const void *a, const void *b);
+
+int
+gal_qsort_index_single_float64_i(const void *a, const void *b);
 
 int
 gal_qsort_index_multi_d(const void *a, const void *b);
diff --git a/lib/gnuastro/table.h b/lib/gnuastro/table.h
index ed183a9..bcb34f6 100644
--- a/lib/gnuastro/table.h
+++ b/lib/gnuastro/table.h
@@ -141,6 +141,11 @@ gal_table_read(char *filename, char *hdu, gal_list_str_t 
*lines,
                gal_list_str_t *cols, int searchin, int ignorecase,
                size_t minmapsize, size_t *colmatch);
 
+gal_list_sizet_t *
+gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t *allcols,
+                         size_t numcols, int searchin, int ignorecase,
+                         char *filename, char *hdu, size_t *colmatch);
+
 
 
 /************************************************************************/
diff --git a/lib/label.c b/lib/label.c
index 6799608..cdeba36 100644
--- a/lib/label.c
+++ b/lib/label.c
@@ -246,7 +246,9 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
     {
       gal_qsort_index_single=values->array;
       qsort(indexs->array, indexs->size, sizeof(size_t),
-            min0_max1 ? gal_qsort_index_single_d : gal_qsort_index_single_i);
+            ( min0_max1
+              ? gal_qsort_index_single_float32_d
+              : gal_qsort_index_single_float32_i) );
     }
 
 
diff --git a/lib/options.c b/lib/options.c
index d962789..fd6623a 100644
--- a/lib/options.c
+++ b/lib/options.c
@@ -595,6 +595,7 @@ gal_options_parse_list_of_numbers(char *string, char 
*filename, size_t lineno)
 
         /* Comma marks the transition to the next number. */
         case ',':
+        case ':':
           if(isnan(numerator))
             error_at_line(EXIT_FAILURE, 0, filename, lineno, "a number "
                           "must be given before `,'. You have given: `%s'",
@@ -1076,6 +1077,90 @@ gal_options_read_sigma_clip(struct argp_option *option, 
char *arg,
 
 
 
+/* Parse name and (float64) values:  name,value1,value2,value3,...
+
+   The output is a `gal_data_t', where the `name' is the given name and the
+   values are in its array (of `float64' type).
+ */
+void *
+gal_options_parse_name_and_values(struct argp_option *option, char *arg,
+                                  char *filename, size_t lineno, void *junk)
+{
+  size_t i, nc;
+  double *darray;
+  char *c, *name, *values;
+  gal_data_t *tmp, *existing, *dataset;
+  char *str, sstr[GAL_OPTIONS_STATIC_MEM_FOR_VALUES];
+
+  /* We want to print the stored values. */
+  if(lineno==-1)
+    {
+      /* Set the value pointer to `dataset'. */
+      existing=*(gal_data_t **)(option->value);
+      darray = existing->array;
+
+      /* First write the name. */
+      nc=0;
+      nc += sprintf(sstr+nc, "%s,", existing->name);
+
+      /* Write the values into a string. */
+      for(i=0;i<existing->size;++i)
+        {
+          if( nc > GAL_OPTIONS_STATIC_MEM_FOR_VALUES-100 )
+            error(EXIT_FAILURE, 0, "%s: a bug! please contact us at %s so we "
+                  "can address the problem. The number of necessary "
+                  "characters in the statically allocated string has become "
+                  "too close to %d", __func__, PACKAGE_BUGREPORT,
+                  GAL_OPTIONS_STATIC_MEM_FOR_VALUES);
+          nc += sprintf(sstr+nc, "%g,", darray[i]);
+        }
+      sstr[nc-1]='\0';
+
+      /* Copy the string into a dynamically allocated space, because it
+         will be freed later.*/
+      gal_checkset_allocate_copy(sstr, &str);
+      return str;
+    }
+  else
+    {
+      /* Parse until the comma or the end of the string.*/
+      c=arg; while(*c!='\0' && *c!=',') ++c;
+      values = (*c=='\0') ? NULL : c+1;
+
+      /* Name of the dataset (note that `c' is already pointing the end of
+         the `name' and `values' points to the next character). So we can
+         safely set `c' to `\0' to have the `name'. */
+      *c='\0';
+      gal_checkset_allocate_copy(arg, &name);
+
+      /* Read the values and write the name. */
+      dataset=gal_options_parse_list_of_numbers(values, filename, lineno);
+      dataset->name=name;
+
+      /* Add the given dataset to the end of an existing dataset. */
+      existing = *(gal_data_t **)(option->value);
+      if(existing)
+        {
+          for(tmp=existing;tmp!=NULL;tmp=tmp->next)
+            if(tmp->next==NULL) { tmp->next=dataset; break; }
+        }
+      else
+        *(gal_data_t **)(option->value) = dataset;
+
+      /* For a check.
+      printf("arg: %s\n", arg);
+      darray=dataset->array;
+      for(i=0;i<dataset->size;++i) printf("%f\n", darray[i]);
+      exit(0);
+      */
+
+      /* Our job is done, return NULL. */
+      return NULL;
+    }
+}
+
+
+
 
 
 
@@ -1251,11 +1336,11 @@ options_sanity_check(struct argp_option *option, char 
*arg,
      `GAL_ARITHMETIC_INPLACE' flags. But we will do this when there are
      multiple checks so from the two check data structures, we only have
      one remaining. */
-  check1=gal_arithmetic(operator1, GAL_ARITHMETIC_NUMOK, value, ref1);
+  check1=gal_arithmetic(operator1, 1, GAL_ARITHMETIC_NUMOK, value, ref1);
   if(ref2)
     {
-      check2=gal_arithmetic(operator2, GAL_ARITHMETIC_NUMOK, value, ref2);
-      check1=gal_arithmetic(multicheckop, mcflag, check1, check2);
+      check2=gal_arithmetic(operator2, 1, GAL_ARITHMETIC_NUMOK, value, ref2);
+      check1=gal_arithmetic(multicheckop, 1, mcflag, check1, check2);
     }
 
 
diff --git a/lib/pdf.c b/lib/pdf.c
index b090267..29628c8 100644
--- a/lib/pdf.c
+++ b/lib/pdf.c
@@ -90,14 +90,14 @@ gal_pdf_suffix_is_pdf(char *name)
  *************************************************************/
 void
 gal_pdf_write(gal_data_t *in, char *filename, float widthincm,
-              uint32_t borderwidth)
+              uint32_t borderwidth, int dontoptimize)
 {
   char command[20000];
   size_t w_h_in_pt[2];
   char *epsname=gal_checkset_malloc_cat(filename, ".ps");
 
   /* Write the EPS file. */
-  gal_eps_write(in, epsname, widthincm, borderwidth, 0, 1);
+  gal_eps_write(in, epsname, widthincm, borderwidth, 0, dontoptimize, 1);
 
   /* Get the size of the image in `pt' units. */
   gal_eps_to_pt(widthincm, in->dsize, w_h_in_pt);
diff --git a/lib/qsort.c b/lib/qsort.c
index b7725c3..3bba8c6 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -188,21 +188,165 @@ gal_qsort_float64_i(const void *a, const void *b)
 /***************          Sorting indexs        ******************/
 /*****************************************************************/
 /* Initialize the array for sorting indexs to NULL. */
-float *gal_qsort_index_single=NULL;
+void *gal_qsort_index_single=NULL;
 
 int
-gal_qsort_index_single_d(const void *a, const void *b)
+gal_qsort_index_single_uint8_d(const void *a, const void *b)
 {
-  float ta=gal_qsort_index_single[ *(size_t *)a ];
-  float tb=gal_qsort_index_single[ *(size_t *)b ];
+  uint8_t ta=((uint8_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint8_t tb=((uint8_t *)(gal_qsort_index_single))[ *(size_t *)b ];
   return (tb > ta) - (tb < ta);
 }
 
 int
-gal_qsort_index_single_i(const void *a, const void *b)
+gal_qsort_index_single_uint8_i(const void *a, const void *b)
 {
-  float ta=gal_qsort_index_single[ *(size_t *)a ];
-  float tb=gal_qsort_index_single[ *(size_t *)b ];
+  uint8_t ta=((uint8_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint8_t tb=((uint8_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_int8_d(const void *a, const void *b)
+{
+  int8_t ta=((int8_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int8_t tb=((int8_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_int8_i(const void *a, const void *b)
+{
+  int8_t ta=((int8_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int8_t tb=((int8_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_uint16_d(const void *a, const void *b)
+{
+  uint16_t ta=((uint16_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint16_t tb=((uint16_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_uint16_i(const void *a, const void *b)
+{
+  uint16_t ta=((uint16_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint16_t tb=((uint16_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_int16_d(const void *a, const void *b)
+{
+  int16_t ta=((int16_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int16_t tb=((int16_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_int16_i(const void *a, const void *b)
+{
+  int16_t ta=((int16_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int16_t tb=((int16_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_uint32_d(const void *a, const void *b)
+{
+  uint32_t ta=((uint32_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint32_t tb=((uint32_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_uint32_i(const void *a, const void *b)
+{
+  uint32_t ta=((uint32_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint32_t tb=((uint32_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_int32_d(const void *a, const void *b)
+{
+  int32_t ta=((int32_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int32_t tb=((int32_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_int32_i(const void *a, const void *b)
+{
+  int32_t ta=((int32_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int32_t tb=((int32_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_uint64_d(const void *a, const void *b)
+{
+  uint64_t ta=((uint64_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint64_t tb=((uint64_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_uint64_i(const void *a, const void *b)
+{
+  uint64_t ta=((uint64_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  uint64_t tb=((uint64_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_int64_d(const void *a, const void *b)
+{
+  int64_t ta=((int64_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int64_t tb=((int64_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_int64_i(const void *a, const void *b)
+{
+  int64_t ta=((int64_t *)(gal_qsort_index_single))[ *(size_t *)a ];
+  int64_t tb=((int64_t *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_float32_d(const void *a, const void *b)
+{
+  float ta=((float *)(gal_qsort_index_single))[ *(size_t *)a ];
+  float tb=((float *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_float32_i(const void *a, const void *b)
+{
+  float ta=((float *)(gal_qsort_index_single))[ *(size_t *)a ];
+  float tb=((float *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (ta > tb) - (ta < tb);
+}
+
+int
+gal_qsort_index_single_float64_d(const void *a, const void *b)
+{
+  double ta=((double *)(gal_qsort_index_single))[ *(size_t *)a ];
+  double tb=((double *)(gal_qsort_index_single))[ *(size_t *)b ];
+  return (tb > ta) - (tb < ta);
+}
+
+int
+gal_qsort_index_single_float64_i(const void *a, const void *b)
+{
+  double ta=((double *)(gal_qsort_index_single))[ *(size_t *)a ];
+  double tb=((double *)(gal_qsort_index_single))[ *(size_t *)b ];
   return (ta > tb) - (ta < tb);
 }
 
diff --git a/lib/statistics.c b/lib/statistics.c
index 4354261..bbf1c56 100644
--- a/lib/statistics.c
+++ b/lib/statistics.c
@@ -1186,7 +1186,7 @@ enum is_sorted_return
 int
 gal_statistics_is_sorted(gal_data_t *input, int updateflags)
 {
-  int out;
+  int out=GAL_BLANK_INT16; /* On some systems, int may be 16-bits wide. */
 
   /* If the flags are already set, don't bother going over the dataset. */
   if( input->flag & GAL_DATA_FLAG_SORT_CH )
@@ -1206,8 +1206,9 @@ gal_statistics_is_sorted(gal_data_t *input, int 
updateflags)
        increasing. */
     case 1:
       out=STATISTICS_IS_SORTED_INCREASING;
+      break;
 
-    /* Do the check. */
+    /* Do the check when there is more than one element. */
     default:
       switch(input->type)
         {
diff --git a/lib/table.c b/lib/table.c
index afc3d21..d6d82ce 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -210,10 +210,10 @@ table_set_strcheck(gal_data_t *col, int searchin)
 
 
 
-static gal_list_sizet_t *
-make_list_of_indexs(gal_list_str_t *cols, gal_data_t *allcols,
-                    size_t numcols, int searchin, int ignorecase,
-                    char *filename, char *hdu, size_t *colmatch)
+gal_list_sizet_t *
+gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t *allcols,
+                         size_t numcols, int searchin, int ignorecase,
+                         char *filename, char *hdu, size_t *colmatch)
 {
   long tlong;
   int regreturn;
@@ -375,10 +375,15 @@ make_list_of_indexs(gal_list_str_t *cols, gal_data_t 
*allcols,
     for(i=0;i<numcols;++i)
       gal_list_sizet_add(&indexll, i);
 
-
-
   /* Reverse the list. */
   gal_list_sizet_reverse(&indexll);
+
+  /* For a check.
+  gal_list_sizet_print(indexll);
+  exit(0);
+  */
+
+  /* Return the list. */
   return indexll;
 }
 
@@ -419,9 +424,9 @@ gal_table_read(char *filename, char *hdu, gal_list_str_t 
*lines,
   /* If there was no actual data in the file, then return NULL. */
   if(allcols==NULL) return NULL;
 
-  /* Get the list of indexs in the same order as the input list */
-  indexll=make_list_of_indexs(cols, allcols, numcols, searchin,
-                              ignorecase, filename, hdu, colmatch);
+  /* Get the list of indexs in the same order as the input list. */
+  indexll=gal_table_list_of_indexs(cols, allcols, numcols, searchin,
+                                   ignorecase, filename, hdu, colmatch);
 
   /* Depending on the table format, read the columns into the output
      structure. Note that the functions here pop each index, read/store the
diff --git a/lib/tile.c b/lib/tile.c
index 9a1629f..94a55bc 100644
--- a/lib/tile.c
+++ b/lib/tile.c
@@ -587,19 +587,20 @@ gal_tile_block_blank_flag(gal_data_t *tile_ll, size_t 
numthreads)
 /***********************************************************************/
 /* The user's specified tile size might not be an exact multiple of the
    parent's size. This function is useful in such cases. It will give the
-   starting tile's size along each dimension. The line below can be the
-   length along any dimension and the tile size along that dimension. You
-   see that when we start with the tile size, we will end up with a last
-   tile that contains the remainder elements.
+   starting tile's size along each dimension.
+
+   The most simplistic way to manage the tiles is to put the regular tiles
+   at the start. The line below can be the length along any dimension, and
+   the tile size along that dimension.
 
         | tile size | tile size | tile size | tile size | remainder
         |           |           |           |           |       |
         ---------------------------------------------------------
 
-   The remainder will always be smaller than `tile size'. So, we will merge
-   the last tile size with the remainder and move that tile to the start.
-   In this way, the size of the first tile will always be between between
-   one and two times the size of the regular tile:
+   The remainder of the scenario above will always be smaller than `tile
+   size' (can be even 1-pixel wide). So, we will merge the first tile size
+   with the remainder.  In this way, the size of the first tile will always
+   be between between one and two times the size of the regular tile:
 
         | first tile        | tile size | tile size | tile size |
         |                   |           |           |           |
@@ -651,14 +652,20 @@ gal_tile_full_regular_first(gal_data_t *parent, size_t 
*regular,
                 {
                   first[i]  = ( remainder + regular[i] )/2;
                   tsize[i]  = dsize[i]/regular[i] + 1 ;
-                  last[i]   = ( dsize[i]
-                                - ( first[i] + regular[i]*(tsize[i]-2) ) );
+
+                  /* If we only have one tile along the dimension, then
+                     `first[i]==dsize[i]'. In this case, the first and last
+                     tiles are the same and must have the same size. */
+                  last[i]   = ( first[i]==dsize[i]
+                                ? first[i]
+                                : ( dsize[i]
+                                    - ( first[i] + regular[i]*(tsize[i]-2) ) ) 
);
                 }
               else
                 {
                   first[i]  = remainder + regular[i];
                   tsize[i]  = dsize[i]/regular[i];
-                  last[i]   = regular[i];
+                  last[i]   = first[i]==dsize[i] ? first[i] : regular[i];
                 }
             }
           else
@@ -668,6 +675,11 @@ gal_tile_full_regular_first(gal_data_t *parent, size_t 
*regular,
             }
         }
     }
+
+  /* For a check:
+  printf("%s: first: %zu, %zu\n", __func__, first[0], first[1]);
+  printf("%s: last: %zu, %zu\n",  __func__, last[0],  last[1]);
+  */
 }
 
 
@@ -757,6 +769,7 @@ gal_tile_full(gal_data_t *input, size_t *regular,
                               first, last, tsize);
   numtiles=gal_dimension_total_size(input->ndim, tsize);
 
+
   /* Allocate the necessary space for all the tiles (if necessary). */
   if(*out)        tiles = *out;
   else     *out = tiles = gal_data_array_calloc(numtiles*multiple);
@@ -819,7 +832,7 @@ gal_tile_full(gal_data_t *input, size_t *regular,
           /* The size of the first and last tiles can be different from the
              majority of the `regular' tiles that have the same size. When
              a tile is on the edge in one of the dimensions, then its
-             `coord[d]' will be either 0 or the last. */
+             `tcoord[d]' will be either 0 or the last. */
           if( first[d] != regular[d]
               && ( tcoord[d]==0 || tcoord[d]==tsize[d]-1 ) )
             {
diff --git a/lib/wcs.c b/lib/wcs.c
index fb23fa1..5a626d8 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -485,7 +485,7 @@ gal_wcs_on_tile(gal_data_t *tile)
 double *
 gal_wcs_warp_matrix(struct wcsprm *wcs)
 {
-  double *out;
+  double *out, crota2;
   size_t i, j, size=wcs->naxis*wcs->naxis;
 
   /* Allocate the necessary array. */
@@ -507,6 +507,33 @@ gal_wcs_warp_matrix(struct wcsprm *wcs)
       for(i=0;i<size;++i)
         out[i]=wcs->cd[i];
     }
+  else if(wcs->altlin & 0x4)     /* Has CROTAi array.   */
+    {
+      /* Basic sanity checks. */
+      if(wcs->naxis!=2)
+        error(EXIT_FAILURE, 0, "%s: CROTAi currently on works in 2 "
+              "dimensions.", __func__);
+      if(wcs->crota[0]!=0.0)
+        error(EXIT_FAILURE, 0, "%s: CROTA1 is not zero", __func__);
+
+      /* CROTAi keywords are depreciated in the FITS standard. However, old
+         files may still use them. For a full description of CROTAi
+         keywords and their history (along with the conversion equations
+         here), please see the link below:
+
+         https://fits.gsfc.nasa.gov/users_guide/users_guide/node57.html
+
+         Just note that the equations of the link above convert CROTAi to
+         PC. But here we want the "final" matrix (after multiplication by
+         the `CDELT' values). So to speed things up, we won't bother
+         dividing and then multiplying by the same CDELT values in the
+         off-diagonal elements. */
+      crota2=wcs->crota[1];
+      out[0] = wcs->cdelt[0] * cos(crota2);
+      out[1] = -1 * wcs->cdelt[1] *sin(crota2);
+      out[2] = wcs->cdelt[0] * sin(crota2);
+      out[3] = wcs->cdelt[1] * cos(crota2);
+    }
   else
     error(EXIT_FAILURE, 0, "%s: currently only PCi_ja and CDi_ja keywords "
           "are recognized", __func__);
@@ -537,11 +564,15 @@ gal_wcs_decompose_pc_cdelt(struct wcsprm *wcs)
   double *ps;
   size_t i, j;
 
+  /* If there is on WCS, then don't do anything. */
+  if(wcs==NULL) return;
+
   /* The correction is only needed when the PC matrix is filled. */
   if(wcs->pc)
     {
       /* Get the pixel scale. */
       ps=gal_wcs_pixel_scale(wcs);
+      if(ps==NULL) return;
 
       /* The PC matrix and the CDELT elements might both contain scale
          elements (during processing the scalings might be added only to PC
@@ -609,6 +640,7 @@ gal_wcs_angular_distance_deg(double r1, double d1, double 
r2, double d2)
 
 
 
+
 /* Return the pixel scale of the dataset in units of the WCS. */
 double *
 gal_wcs_pixel_scale(struct wcsprm *wcs)
@@ -616,20 +648,30 @@ gal_wcs_pixel_scale(struct wcsprm *wcs)
   gsl_vector S;
   gsl_matrix A, V;
   int warning_printed;
-  size_t i, j, maxj, n=wcs->naxis;
-  double jvmax, *a, *out, maxrow, minrow;
-  double *v=gal_pointer_allocate(GAL_TYPE_FLOAT64, n*n, 0, __func__, "v");
-  size_t *permutation=gal_pointer_allocate(GAL_TYPE_SIZE_T, n, 0, __func__,
-                                           "permutation");
-  gal_data_t *pixscale=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &n, NULL,
-                                      0, -1, NULL, NULL, NULL);
+  gal_data_t *pixscale;
+  size_t i, j, n, maxj, *permutation;
+  double jvmax, *a, *out, *v, maxrow, minrow;
 
+  /* Only continue if a WCS exists. */
+  if(wcs==NULL) return NULL;
 
   /* Write the full WCS rotation matrix into an array, irrespective of what
      style it was stored in the wcsprm structure (`PCi_j' style or `CDi_j'
      style). */
   a=gal_wcs_warp_matrix(wcs);
 
+  /* A small sanity check (this won't work on a singular matrix, can happen
+     in FITS WCSs!). In this case, we should return NULL.*/
+  n=wcs->naxis;
+  for(i=0;i<n;++i) {if(a[i*n+i]==0.0f) return NULL;}
+
+  /* Now that everything is good, we can allocate the necessary memory. */
+  v=gal_pointer_allocate(GAL_TYPE_FLOAT64, n*n, 0, __func__, "v");
+  permutation=gal_pointer_allocate(GAL_TYPE_SIZE_T, n, 0, __func__,
+                                   "permutation");
+  pixscale=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &n, NULL,
+                          0, -1, NULL, NULL, NULL);
+
 
   /* To avoid confusing issues with floating point errors being written in
      the non-diagonal elements of the FITS header PC or CD matrices, we
@@ -765,6 +807,7 @@ gal_wcs_pixel_area_arcsec2(struct wcsprm *wcs)
 
   /* Get the pixel scales along each axis in degrees, then multiply. */
   pixscale=gal_wcs_pixel_scale(wcs);
+  if(pixscale==NULL) return NAN;
 
   /* Clean up and return the result. */
   out = pixscale[0] * pixscale[1] * 3600.0f * 3600.0f;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 740bda3..ed58445 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -199,6 +199,11 @@ if COND_WARP
   warp/homographic.sh: convolve/spatial.sh.log
 endif
 
+# Script tests.
+SCRIPT_TESTS = script/list-by-night.sh
+
+# We want to have several FITS files as input for this script.
+script/list-by-night.sh: mkcatalog/aperturephot.sh.log
 
 
 
@@ -252,7 +257,7 @@ TESTS = prepconf.sh lib/multithread.sh $(MAYBE_CXX_TESTS)   
               \
   $(MAYBE_MKCATALOG_TESTS) $(MAYBE_MKNOISE_TESTS) $(MAYBE_MKPROF_TESTS)    \
   $(MAYBE_NOISECHISEL_TESTS) $(MAYBE_SEGMENT_TESTS)                        \
   $(MAYBE_STATISTICS_TESTS) $(MAYBE_SUBTRACTSKY_TESTS)                     \
-  $(MAYBE_TABLE_TESTS) $(MAYBE_WARP_TESTS)
+  $(MAYBE_TABLE_TESTS) $(MAYBE_WARP_TESTS) $(SCRIPT_TESTS)
 
 
 
diff --git a/tests/arithmetic/connected-components.sh 
b/tests/arithmetic/connected-components.sh
index 442f4bb..a49851a 100755
--- a/tests/arithmetic/connected-components.sh
+++ b/tests/arithmetic/connected-components.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/arithmetic/onlynumbers.sh b/tests/arithmetic/onlynumbers.sh
index db4bdf0..7f36be2 100755
--- a/tests/arithmetic/onlynumbers.sh
+++ b/tests/arithmetic/onlynumbers.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/arithmetic/or.sh b/tests/arithmetic/or.sh
index a24fc67..49185cb 100755
--- a/tests/arithmetic/or.sh
+++ b/tests/arithmetic/or.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/arithmetic/snimage.sh b/tests/arithmetic/snimage.sh
index 4be0b94..1885353 100755
--- a/tests/arithmetic/snimage.sh
+++ b/tests/arithmetic/snimage.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/arithmetic/where.sh b/tests/arithmetic/where.sh
index 4e52514..2b9b51f 100755
--- a/tests/arithmetic/where.sh
+++ b/tests/arithmetic/where.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/buildprog/simpleio.sh b/tests/buildprog/simpleio.sh
index 1f3874c..e9fa953 100755
--- a/tests/buildprog/simpleio.sh
+++ b/tests/buildprog/simpleio.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/blankch.sh b/tests/convertt/blankch.sh
index c0af7a8..8691a3a 100755
--- a/tests/convertt/blankch.sh
+++ b/tests/convertt/blankch.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/fitstojpeg.sh b/tests/convertt/fitstojpeg.sh
index 8e6bab2..a4fe2ff 100755
--- a/tests/convertt/fitstojpeg.sh
+++ b/tests/convertt/fitstojpeg.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/fitstojpegcmyk.sh b/tests/convertt/fitstojpegcmyk.sh
index 79b77ce..8e092fb 100755
--- a/tests/convertt/fitstojpegcmyk.sh
+++ b/tests/convertt/fitstojpegcmyk.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/fitstopdf.sh b/tests/convertt/fitstopdf.sh
index 9c6e6da..2460fe3 100755
--- a/tests/convertt/fitstopdf.sh
+++ b/tests/convertt/fitstopdf.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/fitstotxt.sh b/tests/convertt/fitstotxt.sh
index 7deee8f..88b0e6c 100755
--- a/tests/convertt/fitstotxt.sh
+++ b/tests/convertt/fitstotxt.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/jpegtofits.sh b/tests/convertt/jpegtofits.sh
index d1b0e9a..becf11e 100755
--- a/tests/convertt/jpegtofits.sh
+++ b/tests/convertt/jpegtofits.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convertt/jpegtotxt.sh b/tests/convertt/jpegtotxt.sh
index 55a4f68..6ea7cd9 100755
--- a/tests/convertt/jpegtotxt.sh
+++ b/tests/convertt/jpegtotxt.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convolve/frequency.sh b/tests/convolve/frequency.sh
index 80690fe..442b616 100755
--- a/tests/convolve/frequency.sh
+++ b/tests/convolve/frequency.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/convolve/spatial.sh b/tests/convolve/spatial.sh
index 4cf96c9..61e3f7f 100755
--- a/tests/convolve/spatial.sh
+++ b/tests/convolve/spatial.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/cosmiccal/simpletest.sh b/tests/cosmiccal/simpletest.sh
index 123fd1c..9d0f76b 100755
--- a/tests/cosmiccal/simpletest.sh
+++ b/tests/cosmiccal/simpletest.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/cat.txt b/tests/crop/cat.txt
index d791342..8b606e8 100644
--- a/tests/crop/cat.txt
+++ b/tests/crop/cat.txt
@@ -3,5 +3,12 @@
 # Column 3: Y_CENTER   [pixels,f64] Image Y axis position.
 # Column 4: RA_CENTER  [deg,f64]    Right Ascension.
 # Column 5: DEC_CENTER [deg,f64]    Declination.
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 A0B1  500.00  500.00   0.99917157   1.0008283
 c2d3  251.00  251.00   0.99958658   1.0004150
diff --git a/tests/crop/imgcat.sh b/tests/crop/imgcat.sh
index 7a865c8..2f3857b 100755
--- a/tests/crop/imgcat.sh
+++ b/tests/crop/imgcat.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/imgcenter.sh b/tests/crop/imgcenter.sh
index 2aa3753..766f884 100755
--- a/tests/crop/imgcenter.sh
+++ b/tests/crop/imgcenter.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/imgcenternoblank.sh b/tests/crop/imgcenternoblank.sh
index 7d6f3f6..ead666c 100755
--- a/tests/crop/imgcenternoblank.sh
+++ b/tests/crop/imgcenternoblank.sh
@@ -7,6 +7,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/imgoutpolygon.sh b/tests/crop/imgoutpolygon.sh
index 36dea9f..3935c20 100755
--- a/tests/crop/imgoutpolygon.sh
+++ b/tests/crop/imgoutpolygon.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/imgpolygon.sh b/tests/crop/imgpolygon.sh
index e2a0241..88fa320 100755
--- a/tests/crop/imgpolygon.sh
+++ b/tests/crop/imgpolygon.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/section.sh b/tests/crop/section.sh
index 69b22f5..af38d79 100755
--- a/tests/crop/section.sh
+++ b/tests/crop/section.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/wcscat.sh b/tests/crop/wcscat.sh
index 3a56af6..bacdf2b 100755
--- a/tests/crop/wcscat.sh
+++ b/tests/crop/wcscat.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/wcscenter.sh b/tests/crop/wcscenter.sh
index 51673a0..242cb9b 100755
--- a/tests/crop/wcscenter.sh
+++ b/tests/crop/wcscenter.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/crop/wcspolygon.sh b/tests/crop/wcspolygon.sh
index 6d6f9db..85328cb 100755
--- a/tests/crop/wcspolygon.sh
+++ b/tests/crop/wcspolygon.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/during-dev.sh b/tests/during-dev.sh
index 676f69b..61a4edb 100755
--- a/tests/during-dev.sh
+++ b/tests/during-dev.sh
@@ -105,8 +105,8 @@ if [ x"$builddir" = x ]; then echo "builddir is not set."; 
exit 1; fi
 
 
 # Make sure `utilname' doesn't start with `ast' (a common mistake).
-nameprefix="${utilname:0:3}"
-if [ x"$nameprefix" = x"ast" ]; then
+astprefix="${utilname:0:3}"
+if [ x"$astprefix" = x"ast" ]; then
     echo "'utilname' must not start with 'ast'."; exit 1;
 fi
 
@@ -122,7 +122,13 @@ fi
 
 
 # Set the utility's executable file name
-utility="$builddir/bin/$utilname/ast$utilname"
+longprefix="${utilname:0:6}"
+if [ x"$longprefix" = x"script" ]; then
+    execdir="script"
+else
+    execdir="$utilname"
+fi
+utility="$builddir/bin/$execdir/ast$utilname"
 
 
 # If the utility is already built, then remove the executable so it is
@@ -160,8 +166,13 @@ if make -j$numjobs -C "$builddir"; then
     else
         topconfdir="$srcdir"
     fi
-    cp "$srcdir/bin/gnuastro.conf"                                    \
-       "$topconfdir/bin/$utilname/ast$utilname.conf" .gnuastro/
+
+    # Copy the configuration file(s).
+    cfiles="$srcdir/bin/gnuastro.conf"
+    if [ x"$longprefix" != x"script" ]; then
+        cfiles="$cfiles $topconfdir/bin/$utilname/ast$utilname.conf"
+    fi
+    cp $cfiles .gnuastro/
 
     # Append `lastconfig' option to `gnuastro.conf', so the program doesn't
     # go into the system headers.
diff --git a/tests/fits/copyhdu.sh b/tests/fits/copyhdu.sh
index 15c6d8a..3e67409 100755
--- a/tests/fits/copyhdu.sh
+++ b/tests/fits/copyhdu.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/fits/delete.sh b/tests/fits/delete.sh
index 583c67a..7d7292f 100755
--- a/tests/fits/delete.sh
+++ b/tests/fits/delete.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/fits/print.sh b/tests/fits/print.sh
index c191393..86f0c15 100755
--- a/tests/fits/print.sh
+++ b/tests/fits/print.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/fits/update.sh b/tests/fits/update.sh
index f89e0db..9c95413 100755
--- a/tests/fits/update.sh
+++ b/tests/fits/update.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/fits/write.sh b/tests/fits/write.sh
index 4ba5bf4..c706d09 100755
--- a/tests/fits/write.sh
+++ b/tests/fits/write.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/lib/multithread.sh b/tests/lib/multithread.sh
index b9953ca..87a173e 100755
--- a/tests/lib/multithread.sh
+++ b/tests/lib/multithread.sh
@@ -7,6 +7,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/lib/versioncxx.sh b/tests/lib/versioncxx.sh
index c52e9e2..84ae738 100755
--- a/tests/lib/versioncxx.sh
+++ b/tests/lib/versioncxx.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/match/merged-cols.sh b/tests/match/merged-cols.sh
index 9a21aa3..9d136dd 100755
--- a/tests/match/merged-cols.sh
+++ b/tests/match/merged-cols.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/match/positions-1.txt b/tests/match/positions-1.txt
index b7e71b7..78e7396 100644
--- a/tests/match/positions-1.txt
+++ b/tests/match/positions-1.txt
@@ -1,6 +1,13 @@
 # Column 1: ABCD
 # Column 2: EFGH
 # Column 3: IJKL
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 1   1   1
 2   2   2
 3   3   3
diff --git a/tests/match/positions-2.txt b/tests/match/positions-2.txt
index cd41cbc..275dbba2 100644
--- a/tests/match/positions-2.txt
+++ b/tests/match/positions-2.txt
@@ -1,6 +1,13 @@
 # Column 1: ABCD
 # Column 2: ACCU1
 # Column 3: ACCU2
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 1   8.20    7.90
 2   20.1    2.80
 3   4.80    5.20
diff --git a/tests/match/positions.sh b/tests/match/positions.sh
index e9b51c9..fbe3aa2 100755
--- a/tests/match/positions.sh
+++ b/tests/match/positions.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkcatalog/aperturephot.sh b/tests/mkcatalog/aperturephot.sh
index 760cd7a..948fcc6 100755
--- a/tests/mkcatalog/aperturephot.sh
+++ b/tests/mkcatalog/aperturephot.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkcatalog/detections.sh b/tests/mkcatalog/detections.sh
index e6b42b5..e95eb67 100755
--- a/tests/mkcatalog/detections.sh
+++ b/tests/mkcatalog/detections.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkcatalog/objects-clumps.sh 
b/tests/mkcatalog/objects-clumps.sh
index 1cbd776..16849d3 100755
--- a/tests/mkcatalog/objects-clumps.sh
+++ b/tests/mkcatalog/objects-clumps.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mknoise/addnoise.sh b/tests/mknoise/addnoise.sh
index 206f5b1..d1634c0 100755
--- a/tests/mknoise/addnoise.sh
+++ b/tests/mknoise/addnoise.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/clearcanvas.sh b/tests/mkprof/clearcanvas.sh
index fc50418..f6c8e9f 100755
--- a/tests/mkprof/clearcanvas.sh
+++ b/tests/mkprof/clearcanvas.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/clearcanvas.txt b/tests/mkprof/clearcanvas.txt
index 3491f52..d4259fe 100644
--- a/tests/mkprof/clearcanvas.txt
+++ b/tests/mkprof/clearcanvas.txt
@@ -9,8 +9,15 @@
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
 #
-# Note that the positions and radii are multiplied by 5 compared to 
`mkprofcat1.txt',
-# because we are using the over-sampled image as a canvas.
+# Note that the positions and radii are multiplied by 5 compared to
+# `mkprofcat1.txt', because we are using the over-sampled image as a
+# canvas.
 #
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1 502     502     flat 100   1 45.000 1.000  1 2.000
 2 251.605 254.135 flat 29.89 1 77.650 0.801  2 2.000
diff --git a/tests/mkprof/ellipticalmasks.sh b/tests/mkprof/ellipticalmasks.sh
index 25b1167..0899020 100755
--- a/tests/mkprof/ellipticalmasks.sh
+++ b/tests/mkprof/ellipticalmasks.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/ellipticalmasks.txt b/tests/mkprof/ellipticalmasks.txt
index f3cf4fd..3db0172 100644
--- a/tests/mkprof/ellipticalmasks.txt
+++ b/tests/mkprof/ellipticalmasks.txt
@@ -8,5 +8,12 @@
 # Column 8:  Axis ratio        [frac, f64]   Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     100.40     100.40     circum   20.00     2.500      45.000     1.000     
 NaN     2.000
 2     50.321     50.827     flat     5.978     1.320      77.650     0.801     
 -1     2.000
diff --git a/tests/mkprof/mkprofcat1.txt b/tests/mkprof/mkprofcat1.txt
index bf82212..b291d32 100644
--- a/tests/mkprof/mkprofcat1.txt
+++ b/tests/mkprof/mkprofcat1.txt
@@ -8,6 +8,13 @@
 # Column 8:  Axis ratio        [frac, f64]   Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     0.0000     0.0000     moffat     3.000     4.765      0.0000     1.000   
   0.000     5.000
 2     100.40     100.40     sersic     20.00     2.500      45.000     1.000   
   -18.0     5.000
 3     50.321     50.827     sersic     5.978     1.320      77.650     0.801   
   -15.0     5.000
diff --git a/tests/mkprof/mkprofcat2.txt b/tests/mkprof/mkprofcat2.txt
index 16e3da1..9ce2b83 100644
--- a/tests/mkprof/mkprofcat2.txt
+++ b/tests/mkprof/mkprofcat2.txt
@@ -8,4 +8,11 @@
 # Column 8:  Axis ratio        [frac, f64]   Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     0.400    100.40     1     20.00     2.500      45.000     1.00       
-18.0     5.000
diff --git a/tests/mkprof/mkprofcat3.txt b/tests/mkprof/mkprofcat3.txt
index 6005f95..dba7d4d 100644
--- a/tests/mkprof/mkprofcat3.txt
+++ b/tests/mkprof/mkprofcat3.txt
@@ -8,4 +8,11 @@
 # Column 8:  Axis ratio        [frac, f64]   Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     100.40    0.40     1     20.00     2.500      45.000     1.00       
-18.0     5.000
diff --git a/tests/mkprof/mkprofcat4.txt b/tests/mkprof/mkprofcat4.txt
index 5305532..a38cbe1 100644
--- a/tests/mkprof/mkprofcat4.txt
+++ b/tests/mkprof/mkprofcat4.txt
@@ -8,4 +8,11 @@
 # Column 8:  Axis ratio        [frac, f64]   Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]  Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist, f64]   Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     0.40    0.40     sersic     20.00     2.500      45.000     1.00       
-18.0     5.000
diff --git a/tests/mkprof/mosaic1.sh b/tests/mkprof/mosaic1.sh
index 5f52742..db3f346 100755
--- a/tests/mkprof/mosaic1.sh
+++ b/tests/mkprof/mosaic1.sh
@@ -11,6 +11,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/mosaic2.sh b/tests/mkprof/mosaic2.sh
index d5043e6..1a263f5 100755
--- a/tests/mkprof/mosaic2.sh
+++ b/tests/mkprof/mosaic2.sh
@@ -13,6 +13,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/mosaic3.sh b/tests/mkprof/mosaic3.sh
index 4d530c4..f3b7665 100755
--- a/tests/mkprof/mosaic3.sh
+++ b/tests/mkprof/mosaic3.sh
@@ -11,6 +11,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/mosaic4.sh b/tests/mkprof/mosaic4.sh
index e894a3e..8877e99 100755
--- a/tests/mkprof/mosaic4.sh
+++ b/tests/mkprof/mosaic4.sh
@@ -11,6 +11,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/radeccat.sh b/tests/mkprof/radeccat.sh
index 7363cf8..a3c83f7 100755
--- a/tests/mkprof/radeccat.sh
+++ b/tests/mkprof/radeccat.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mkprof/radeccat.txt b/tests/mkprof/radeccat.txt
index 8340859..f318f1a 100644
--- a/tests/mkprof/radeccat.txt
+++ b/tests/mkprof/radeccat.txt
@@ -8,5 +8,12 @@
 # Column 8:  Axis ratio        [frac,  f64]    Axis ratio of profile
 # Column 9:  Magnitude         [ABmag, f64]   Magnitude of profile within 
truncation radius
 # Column 10: Truncation radius [dist,  f64]    Truncation radius to stop 
building profile
+#
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 1     0.99987331  1.0001617     sersic     10.00     2.500      45.000     0.3 
     -6.0     2.000
 2     0.99929656  1.0006917     sersic     10.00     2.500      135.00     0.3 
     -6.0     2.000
diff --git a/tests/noisechisel/noisechisel.sh b/tests/noisechisel/noisechisel.sh
index 81e8add..88ffede 100755
--- a/tests/noisechisel/noisechisel.sh
+++ b/tests/noisechisel/noisechisel.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/mknoise/addnoise.sh b/tests/script/list-by-night.sh
similarity index 67%
copy from tests/mknoise/addnoise.sh
copy to tests/script/list-by-night.sh
index 206f5b1..6825a0f 100755
--- a/tests/mknoise/addnoise.sh
+++ b/tests/script/list-by-night.sh
@@ -1,4 +1,4 @@
-# Add noise to an input image.
+# List all FITS files in build directory by date.
 #
 # See the Tests subsection of the manual for a complete explanation
 # (in the Installing gnuastro section).
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
@@ -27,10 +28,10 @@
 # care about the size of the image, but the larger one will be used by
 # those that do: for example SubtractSky and NoiseChisel will be better
 # tested on a larger image.
-prog=mknoise
-img1=convolve_spatial.fits
-execname=../bin/$prog/ast$prog
-img2=convolve_spatial_scaled.fits
+prog=sort-by-night
+dep1=fits
+dep1name=../bin/$dep1/ast$dep1
+execname=../bin/script/astscript-$prog
 
 
 
@@ -42,16 +43,19 @@ img2=convolve_spatial_scaled.fits
 # If the dependencies of the test don't exist, then skip it. There are two
 # types of dependencies:
 #
-#   - The executable was not made (for example due to a configure option),
-#
-#   - The input data was not made (for example the test that created the
-#     data file failed).
+#   - The executable script was not made.
+#   - The programs it use weren't made.
 if [ ! -f $execname ]; then echo "$execname doesn't exist."; exit 77; fi
-if [ ! -f $img1     ]; then echo "$img1 does not exist.";    exit 77; fi
-if [ ! -f $img2     ]; then echo "$img2 does not exist.";    exit 77; fi
+if [ ! -f $dep1name ]; then echo "$dep1name doesn't exist."; exit 77; fi
+
+
 
 
 
+# Put a link of Gnuastro program(s) used into current directory. Note that
+# other script tests may have already brought it.
+ln -sf $dep1name ast$dep1
+
 
 
 # Actual test script
@@ -60,7 +64,8 @@ if [ ! -f $img2     ]; then echo "$img2 does not exist.";    
exit 77; fi
 # `check_with_program' can be something like `Valgrind' or an empty
 # string. Such programs will execute the command if present and help in
 # debugging when the developer doesn't have access to the user's system.
-export GSL_RNG_SEED=1
-export GSL_RNG_TYPE=ranlxs2
-$check_with_program $execname --envseed $img1
-$check_with_program $execname --envseed $img2
+#
+# Since we want the script to recognize the programs that it will use from
+# this same build of Gnuastro, we'll add the current directory to PATH.
+export PATH="./:$PATH"
+$check_with_program $execname *.fits
diff --git a/tests/segment/segment.sh b/tests/segment/segment.sh
index ad32674..d995f35 100755
--- a/tests/segment/segment.sh
+++ b/tests/segment/segment.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/statistics/basicstats.sh b/tests/statistics/basicstats.sh
index 7bb6ba4..a412360 100755
--- a/tests/statistics/basicstats.sh
+++ b/tests/statistics/basicstats.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/statistics/estimate_sky.sh b/tests/statistics/estimate_sky.sh
index 3735844..e7b2fa9 100755
--- a/tests/statistics/estimate_sky.sh
+++ b/tests/statistics/estimate_sky.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/statistics/from-stdin.sh b/tests/statistics/from-stdin.sh
index 7105fdb..e3cb588 100755
--- a/tests/statistics/from-stdin.sh
+++ b/tests/statistics/from-stdin.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/statistics/stdin-input.txt b/tests/statistics/stdin-input.txt
index 9b92619..36847f6 100644
--- a/tests/statistics/stdin-input.txt
+++ b/tests/statistics/stdin-input.txt
@@ -1,3 +1,9 @@
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 5.3932774677668
 4.7389534611694
 4.6367278925857
diff --git a/tests/table/fits-ascii-to-txt.sh b/tests/table/fits-ascii-to-txt.sh
index e3f4393..2d2e3e6 100755
--- a/tests/table/fits-ascii-to-txt.sh
+++ b/tests/table/fits-ascii-to-txt.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/table/fits-binary-to-txt.sh 
b/tests/table/fits-binary-to-txt.sh
index 8073b74..09cbe46 100755
--- a/tests/table/fits-binary-to-txt.sh
+++ b/tests/table/fits-binary-to-txt.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/table/table.txt b/tests/table/table.txt
index 7efb24a..66daabc 100644
--- a/tests/table/table.txt
+++ b/tests/table/table.txt
@@ -30,7 +30,12 @@
 # the `width - precision - 1' (when everything is default, you can get
 # these values from `lib/gnuastro/table.h').
 
-
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice and
+# this notice are preserved.  This file is offered as-is, without any
+# warranty.
 
 1    -1    The vertical lines     3455  -3455  1  -1   9     1874.103872  
8.391334343995    1
 2    -2    are only for easy      3466      -3466  2  -2   10    123.93373    
893.3497e5        2
diff --git a/tests/table/txt-to-fits-ascii.sh b/tests/table/txt-to-fits-ascii.sh
index e5edb5d..8ca4501 100755
--- a/tests/table/txt-to-fits-ascii.sh
+++ b/tests/table/txt-to-fits-ascii.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/table/txt-to-fits-binary.sh 
b/tests/table/txt-to-fits-binary.sh
index 02350f5..69b5051 100755
--- a/tests/table/txt-to-fits-binary.sh
+++ b/tests/table/txt-to-fits-binary.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/warp/homographic.sh b/tests/warp/homographic.sh
index 9d48afc..c350aa2 100755
--- a/tests/warp/homographic.sh
+++ b/tests/warp/homographic.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright
diff --git a/tests/warp/warp_scale.sh b/tests/warp/warp_scale.sh
index 23537ad..e0a3b0d 100755
--- a/tests/warp/warp_scale.sh
+++ b/tests/warp/warp_scale.sh
@@ -6,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
 # are permitted in any medium without royalty provided the copyright



reply via email to

[Prev in Thread] Current Thread [Next in Thread]