Replaced branches with switch