Use event handlers to handle data sync