Reformatted the code.
Code Refactoring and setting up the simulator for console and gui mode.