db backend mostly done