Added print routine in sort function to confirm its sorting correctly