order of params of sort-function changed and readme made more comprehensive