Splitting out the code to modularise the API calls and adding in some jsdoc