Refactoring of syncing mechanism

Refactored all syncing logic into a separate module. Syncing now also occurs on
a reconnect of the web socket connection to ensure updates aren't missed
during connection down time. Closes #57