Refactor to separateout node-specific code