Remove dead code; more code cleanup

* removed functions that aren't used anymore
* spent some more time cleaning up test code