Refactored code to make use of _getNode method