Refactoring some functions in the Quaternion class.