Code for new Query page