add a bunch of tests, fix some stuff, remove some old stuff