updated constructor to allow for overriding into a different node type
implemented flexible text parser