Adding code to check if puzzle solved.