sorted the queries so all use same way to connect to db