-Started implementation of main loop
-Corrected some bugs