Seggregated api functions away from heatmap.js, into api.js