Split up syncmessagesto() into individual components so we can control the synchronization process with finer detail from above.