refactored lots of PG prepared calls to db. TODO: Add these to classes, reduce # of random functions