Starting code from Damon Kohler at http://code.google.com/p/pyrobot/ version 51