Tweaked the vm script more to make it more flexible