Generic Vector and Matrix types, bug fixes