"Clean" command. Some refactoring.