Tests, documentation fix, bug fix