querying and updating records