Slope side detection made more accurate, less cpu-intensive (thanks
Tarig)