Add basic functionality for data streams and refactor.