Refactored http requests and stream reading