Moved keypress handling code into the Snake class