Big refactor, break streams out into their own classes. Add tests.