[COREVM-85] Code cleanup + more tests