refactored the screen clearing