created a central function for all DB conns and queries