Refactored code, setup state machine to test with. Analyzed subsquares for better results.