some cleanup + dumb caching
some test cleanup