simplifications and bug fixes:
    * simplified peak_positions (now a list of mutable size).
    * renamed b to peak_position (because that's what it is)
    * fixed the bug where argmin was looking at an empty slice