editted the emulator code