switched if else pattern matchers with case when