Make data_available take stream instead of data and len. Cleanup a lot of now unused code.