Emulator Version 2

Fixed the bug from Version 1.