Replace given/when with for/if/elsif/else