Logic fix

Replaces nested conditions with if else if