swarm: change if/elseif block to switch case