WIP: refactoring vector and matrix