implements unique algorithm