Declare variables read-only where possible.

Local otherwise.
Tidy-up long lines.
Tidy-up whitespace.
Define table names in a variable.
Prefix major command entry points with "command_"
Move all top-level commands into their own functions.
Clean-up command dispatch.
Tidy-up more whitespace.
User descriptive name in variable.
Fix indentation.
Namespace db functions.
Remove unused error handling.
Use explicit variable name.
Fix md5 on Mac OS X
Fix premature stringification.
Use explicit variable name.
Organize functions into sections.
Move md5 command determination to environment setup.
Rename env_create to env_setup.