fixed a type hint docblock.
refactored a bit and repaired the tests.