Added motion detection.