Complete set of test cases.
Still unstable.
Minor improvements