cleaned up code, and got rid of all global variables