reduce similar codes