the if with the function on the inside of it worked