Simplified the vector and matrix implementations.