I think it is clearer to separate the exit condition from function type checking