sorts data and prints data
seems to work with sorting now