api mostly done now