Adding peaks function