Fix clear() function

Changed the clear() function to remove the garbage data stuck in the right-hand margin of the screen.