Added distinct to query