simple method to remove duplicate element.