Refactored Vimpy's main routines.