refactored re-typed node construction

review by @szeiger