Updated processCommands()