Added logic for flickering light