Array sorting and other usage