tweaked the approach used for layered rendering for more clarity.