reduce code redundancy