adjusted variable name & added check func