change the unary algorithm