Refactored functions from main program.

New functions have names that are self-explanatory so that the main
routine can be read and understood.
Incorporated docopt as a file and start using it.

Command line format and parsing is now done using docopt.
The doc string updated before use by docopt.
Output is now less verbose.
Merge branch 'feature/cmd_and_docopt' into develop