added check_answer function