paths optimization