Refactoring using records