MOAR TESTS and code cleanup