Hinge algorithm