add quaternion code