Finished the API I think. Need to check it all works now