Clean up script: shebang, better docs, tests, better directory,
cleaner logging, bashicisms.

Tests.
README