Improving emulation code, changes to memory system