Structure update, query update and other refactorings