Adding code for checking if puzzle solved.