added option to chose sort mode for statistics