Added edge detection