Refactored existing code for Proj3d.