Extract logic from index.html
Add retrieval from Cast API