Remove dependency on which and use command vs type in have function