JG: better version of last pulse for online display
JG: small change