Cycle detection in the Tree calss

Hello. I've added the cycle detection to the Tree class like explained in the #174 issue.

I've also corrected one or two minor bugs in the tree class and made some tests.

To do this I had to change a few things to how the Tree class should be used. For example, when I first made the functionallity, before it got turns into a class implementation, I used the "tuple" way of representing a tree:

```
(node, [(son1, [...]), (son2, [...])])
```

Then, the Tree class still used this. I think this is no longuer needed, so I removed it.

I'll justify my changes better tomorrow. I'm to tired to be formal right now.

@rajat974, I think the bug I mention in #174 never existed. It must have been some confusion by me. Anyway, all is working now. Tomorrow, I'll explain a few things better.