Fix time update issue. More refactoring
Merge