Code refactor

Move the diagnostic printing code out of the main file and into its own
implementation file.

Added comments to the main source file.

Created a Makefile