more tests for untested code, delete some unused code