Changed looping variables to only use one counter throughout the program.
Cleaned up files