Shift check_term logic into function
shifting function check term