More refactoring of code duplication.