unary algo implementation