implement full node deallocation

I think the order of the checks could be changed as checking for null is probably cheaper