Add Factory pattern for node