tripeaks.py update

solved, but need some tweaking and optimization