added sql funcitonality