Refactored time handling.