Fixes, tests, documentation