Fixed a bug that resulted in overwriting the command line. Improved variable naming and added comments