Moved everything into a class, so that certain resources would no longer be
    passed around all the time