Split up vm code a bit