Avoid cascading if-else in Kotlin

Avoid cascading if-else in Kotlin

Kotlin coding conventions denotes that we should prefer if for binary and when for three or more options.