Big refactoring of commands.