Added better array sort. Small optimizing