Refactor time grouping, add new method