updated so that query entered is saved and sent correctly to the backend