Refactored createNodeString to use forEach not for in.