Program refactoring