Added grouped, buffer, fixed several termination bugs