Adjust hash groupify and perform cleanups