First attempt at handling edge detection