more cleanup of updateGravity(), fun with parameters