Fix code duplication.