implemented non-functional Deutsch thinnink algorithm. TODO:mind debug