use Hash instead of Set and cleanup