Simplify contour detection. Significantly fewer operations are now required