Realised unique algoritm