Changed the rendering logic from 2D to 3D