Refactoring Sync.js into Client and SyncProtocolHandler