lots of initial work to the api