Made some temporary changes so that the tests pass. This merge has
revearled the need to enforce better scoping, so that classes can only
refer to classes they are allowed to refer to, which should also
increase the performance of the code too.