added a sort array function to simply sorting auto sort will sort initially