edge detection/handeling