Added support for Toplevel vectors.
Refactored a bit and removed some unused code.
Added furter unit-tests.