bug fix + enhance performances
add a simple lock mecanism
prepare tree management