working version of sobel