basic implementation of --peak option