stat sorting, front end work