Remove code duplication.