minor refactoring and bug fixes
minor updates on the simulator file