refactored command loop to allow for multi key commands