2nd phase in progress, smooting, gradient magnitude and sigmoid functions working properly