Refactor query out into instance with delegates the update