Making the postgres db connection more flexible