added code to sync local storage and server