ExitGroup funcionality added, and optimization.