Reduce code redundancy