Reorderd PainMessage function order to top-down for readability.