abstract db out of parse and refactor