refactor time