clean up if statement logic