Various improvements.
Documentation.
Fixed tests.