added peak calculation