separating out db handler