small changes in logic