removed some repetitive code