add logging; optimize order when distributing;