Replace if else with case