Minor code refactoring, cleaning, leaks fixing.
Fix the detection of citation node.