[MOD] Core, locking: various refactorings