Extracting API code into it's own file