add distribution cache stuff
more sorting