Refactor a bunch of stuff. Add some basic integration tests