this seems mostly baked at this point, time to write some tests.