copied a lot of the soln - now have auth issue with pg