refactored vm control