Simplified code and stabilized brightness.