Extracted the time sync algorithm and ui