make some small code logic changes