Clean up of if statements to be more modern and safe.