Implemented queries inside Gui