Added changes to Query.java