Modify transverseMass function