Reduce some duplication found by code climate.