cleans up code a bit.  [not yet tested]