Extracted code into db.clj