Could these checks not be done with a query as to whether `k.x > _maxk` (ditto for `y`)?