modify processCommand() to suit testing better