Improved fading code.