fix server sorting on threads, and do some more es6 rewriting