Code clean up for if statements