refactoring VM