working on independant db functions. currently trying to get aggregation working