multiple improvements; "smart" set base

and added convenience routines for looping over boxes
use a subtree to speed up convergence if n_cell>2