Factor out synchronization function creation