remove repetitive code.