refactor swarm