Cleaned and added key press functions