Improve query by reusing the max values for X and Y based on the resolution
Adds test for resolution changes in torque query