removed a bunch of repetitive code