updated db connect function
added some queries