refactored checkAns