Pass the API explicitly as an argument to callback functions
Combined all together