Removes unneeded groups