vectormath refactored