Implemented thread safety for nodes

Note that there are a few places where it's not, but that these need implementation anyway.