revise algorithms