Running time is too long for large no. of peaks.
Will be extended and edited here in the near future.