Refactored index to call API
Refactored index into a page