Sound refactoring