Added DieWithError. Processing command line args. Renaming variables and reformating comments.