Ripping as much as possible from evancz's pong tutorial/skeleton.