Add keyPressed function vs variable comparison