Refactor time