updated the logic to generte policies