Added documentation

Added initial documentation for what this application does.
tidied up source.