Shadow & OCR2 fix

+Shadow rewrite
+OCR2 fix.
+Applied hotfix to thresholdDetermination against division by 0!