Better clean up code for sync manager