Added solution checking function.