Moving some more sync code around