Code refactoring for discrete nodes