Weather impact 'priority' for Network Rail
The impact of climate change is being given priority in the next phase of investment for Scotland's railways.
Bridges will also get more attention, according to Network Rail's UK-wide five year plan from 2019 to 2024.
And there is to be a renewed push for freight traffic, since the closure of coal-burning power stations removed much heavy traffic from Scottish lines.
As part of the ScotRail Alliance, Network Rail owns and maintains most rail assets in Scotland.
Its report explains that it is on track to miss its cost targets for track and signalling replacements over 2014 to 2019. However, it expects to reach its performance targets.
Between next year and 2024, one of the main targets is to step up the resilience of the Scots network to cope with extreme weather.
That includes earthworks, drainage, cutting back vegetation, coastal defences and sensors to monitor landslip risk.
It includes the option of special measures for high-risk stretches of lines, such as the Saltcoats coastal line in Ayrshire, improved protection of electric cabling, and possible installation of water pumps at key locations.
The intention is both to reduce the number of weather events that stop services, and the length of time it takes to re-start them.
Over 10 years, the water management unit of Network Rail has had to deal with flooding at 100 sites.
The moves to improve maintenance of metal bridges follow a finding that around a third of metal under-bridges are in poor condition - far higher than any other region of Great Britain.
The average metal bridge carrying a rail line in Scotland is painted every 58 years, and that is deemed to be "unsustainable".
For metal bridges over railways, the rate of painting is down to once every 150 years - also "unsustainable" - and Network Rail wants to improve that to a rate of once every 61 years, over the course of the next five-year plan.
The report explains that the rail freight business in Scotland is in a worse state than other parts of Britain, as it was heavily dependent on the delivery of coal to Longannet and Cockenzie power stations, both now closed.
Coal represented 40% of freight operations. So instead of improving freight, the report sets out a plan for its recovery. The aim is to grow business by 7.5% each year, by making it easier for new haulage customers to use rail.
Alex Hynes, managing director of the ScotRail Alliance, said: "We are delivering a punctual and reliable service every day for passenger and freight services both within Scotland and cross border - something we are not prepared to compromise.
"So we are protecting the resilience of the railway by investing in the infrastructure to address the weather challenges seen in recent years and to protect against ongoing extremes of weather.
"But, despite this success, there is always more that we can do. The untapped potential that exists is enormous and to build the best railway Scotland has ever had will take a complete transformation of what we do and how we do it.
He continued: "It's not just about passengers. Securing and retaining rail freight traffic in Scotland will be more challenging than anywhere else in the UK. The faster than anticipated decline in what was Scotland's bedrock for rail freight, coal, resulted in a reduction of over 40% of freight moved to, from and within Scotland.
"This has radically changed the face of rail freight in Scotland from a buoyant industry to one that will require a period of recovery and support to build up new and sustainable markets."