Refactor|Map Renderer: Turned the writeLeafPlane() function stack into a linear process

Plus cleanup.