refactored node constructor