refactoring dbread in to db to be used for slaves and master