optimization of paths done