Added edge detection.