Improve Query definition