Rougly followed Richard Jones' pygame tutorial.