finish algorithm's implementation