Reworked diagonal checks (to be more resource efficient and easy to
understand), added tests for diagonal checks.