restruct query