Bugs fixed after first tests
Dumping of internal state added