Started working on the api, not happy with code layout