Added scoping to distinct command