cleanup and a ton of tests