moving if statement around