removed repetitive code