Many fixes improved stability. Upgraded tests.