refactored test code, fixed indexing issues inEmuCore