Changed implementation to use stream instead of REST API