remove small code duplication