Fixed up groupEvents. Added prepend and append options