add flags and peaks