Make various things private that aren't essential public API

Required moving some of the test code into the sbt packages
since the tests need to get at a few private things.