Add periodic background sync
Closes #349