Changed amplitude variables to get the latest peak.