more improvements to critical edge detection