Moved VM code into common