Refactoring: code sharing