Refined edge examination code.  Added histogram equalization