adding query and update functions