brought all queries over from pgadmin