added cycle logic for end date