Major new VM management logic & refactoring & tests.