revamped dimming.js