sort data, and start getting some basic stastics