some clean-up and docstringing
more docstrings
some clean-ups.  Also let scratch_array() take an optional nvar argument
some more cleaning