improving sobel custom algorithm