Move Emulator debug functions to separate module