Big rework of the tests.

- Implicitly test more situations.
- Clean the code.
- Add more tests.