CodeBlockNode fix and some code refactoring