Remove unnecessary commands.