QSV: some refactoring