Refactoring of vector math