move all the logic into the VM