Small refactoring an comments.
Refactoring and locking node, when working with layers.