cleaned up and commented some motion control code