Merge "Fixes and optimizations of two quaternion functions."