Sorting out arrays and display