Stabilization and new tests

I am sorry for huge amount of code, this was my compass and next PRs will be done with fine granularity, I promise.