add condition, at the top of the function