Just as a note: This recursion seems to allow presets to cause circular reference loops.  It might be better to use a stack in this case than recursion.