More preparation for query page