Making it easier to test

This involves exposing some internals and breaking things up a bit better.