refactors of vmctl: break up routines, generic error handling