First revision of autobrightness script