Changed clearing method to avoid filling up the terminal