General cleanup and more tests