Some refactor on the swarm class