add test for empty immutablevector
docs and refactoring