Further improvements to the sync algorithm.