removed unnecessary distinct in several queries