adding metric option to recurrence function