Reformatting for queries