Implementation of HR3 algorithm