Added ungroup and fixed remove singletons