refactor VirtualMonitor code to separate files