Removed unused and switch the tree rlock to a lock
A refactor of stuff has been done.