Refactor time pattern