geom/box: Import remainder of box functions from AppEngine and tidy up.