completed method to check if the answer is valid