Move sorting inside tagging package.