Fix bug in win-screen code and consolidate keypress function