completed proper read and write of db