this check should be done at the start of the function, and returned there.