Replacing conditionals with logical operators