Added an exit function, included checking for non-existant filenames and did proper PEP8 formatting.
Moved old, unused testing function to a place where it is more aesthetically pleasing