Pattern formation and functionality in swarm models