improving flock example