Test work

Clean up some old unused code and add some more tests to get a few more files up to full test coverage.