Adds more tweaks to shadow-generation algorithm.

It still doesn't work; FML.