Refactoring to allow for more modular 3d representation.