separated API calls into public/javascripts/APICalls.js