improved array sorting capabilities