better MAR algorithm