Added distinct and tests. Ready for tagging