Remove dead and repetitive code