refactor - move stuff to dba layer