This paper describes a new algorithm for finding software clones.It is conceptually independent of the source language of the analyzed programs, working at the level of abstract syntax trees.The algorithm considers that two sequences of statements form a clone if one of them can be obtained from the other by replacing some subtrees.To our knowledge this notion was not previously employed in the literature.It allows to take into account all information on the syntactic structure of a program.We have implemented this algorithm in the tool Clone Digger.It currently supports the Python and Java languages.