Reworked the fog calculation.