Improving API calls and chart drawing