Handle commands modification

Broke out handleCommands() into a switch statement and respective
private methods.