[Olena-patches] milena r1239: Add best canvas and make median_dir use it