Remove repetitive code