backend api mostly done