[COREVM-85] Code cleanup + more tests (Closes #23)