flock algorithm improvement, and some client app rest helpers