refactored added clear command
refactored and added clear method