First pass implementation of the api