Moving core to API module. Creating functions to formulate API calls.