added logic for checking user answer.