Refactor out remaining generators, add more tests