refactored db calls into separate file
refactored db calls into separate file