included averaging of red and motion detection