added recursive substitute, may never terminate