Rework initialization of vm