Removes duplicate values from an array