Adding Database query fetching funcationality