Functional sobel operator

Sobel operator functional but the code is messy. Need to clean up.