Made a test file and implemented many of the suggestions made by James
Finished changes for making the code cleaner.