added new subroutine to sort source; and checked with data dump