How to find peaks & eliminate flat tops

rogernm001:
Is it possible for anyone to look through my code and fix any imperfections, I'm stumped..

Even after following the advice in reply #2?