changed query for image ordering.