Transition to new-style variable handling done. Got rid of some legacy code.
Added some docstrings...