Remove circular reference

As discussed in #1348.

Currently not passing tests due to lint errors, which I have been unable to work out.

The code reorganisation should be correct as described in 1348 though.