simplified unique function