Writing the API