Refactoring and ClearScreen functionality