Change to handleCommands

Changed Handlecommands to a switch statement and added methods for each
case.  Slight modifications to loop to handle scope issues.