replace distinct and use more effective loading