Refactor weekly recurrence function