VM rewritten on Scala