Working Code (Connected with API)