main and sobel stuff