Added a solution check function.