Minor refactoring of cmds module