refactored peak picking