added new feature to extract the peak time and values
added unflatten list function