better contour detection
rewrote check.py