Improve Query.hs