Refactored clearScreen()to be cross-platform compatible