Lots of changes, refactoring vector and tests