JK: Refactored calendar grouping agian.