implement unique algorithm