more changes to allow recursive instance search, still stuck