Revert "Simplify occlusion code"

This reverts commit d0d56a48bf956d340fd671fab83ea15f086eb6ca.
Simplify and avoid breaking the algorithm...