Improve checking for commands