added sortandremoveduplicates to finish off key for Array constructor