change to a better control flow