(AP) - The nation's railroads are safer than ever, despite recent high-profile accidents like this week's fiery derailment in Maryland. Derailments and crossing accidents have steadily declined nationwide even as businesses have come to increasingly rely on trains to move their raw materials and products. The number of train accidents fell 43 percent to 1,712 between 2003 and last year, while the number of incidents at rail crossings dropped 34 percent to 1,960. And the total number of deaths declined 19 percent to 705 over the decade, according to the Federal Railroad Administration. Railroads have been investing in their equipment and track, their employee training and in technological tools to help detect problems before they can derail a train. Fewer derailments means fewer delayed deliveries and less need for railroads to re-route traffic for hours or even days. That all helps the industry's bottom line. "There's a strong incentive in the industry to maintain and invest in infrastructure," said Allan Zarembski, an industry veteran who now leads the railroad engineering and safety program at the University of Delaware. Last year, the nation's biggest freight railroads generated $70.1 billion of revenue and $12 billion of net income, according to the Association of American Railroads. They combined to haul 1.8 billion tons of freight as auto sales improved, the economy picked up and shipments of intermodal containers grew. Still, the rate of train accidents per million miles of rail traffic fell to 2.3 from 4.1 a decade ago. Highway crossing accidents per million miles dropped to 2.6 from 4. "Last year was the safest year on record for the railroad industry," said Federal Railroad Administration spokesman Warren Flatau. That might surprise anyone who saw the video of a smoldering CSX train after a chemical-fueled explosion near Baltimore Tuesday. Early indications are that the train struck a truck at a private crossing before the derailment. The Maryland accident comes on the heels of the derailment of a commuter train in Bridgeport, Conn. earlier this month. More than 70 people were injured when a second train struck the one that derailed. And last weekend, a freight train crash in Rockview, Mo., injured seven people and destroyed a highway overpass, which could take a year to repair. But industry representatives say those accidents aren't representative of rail's safety record and the efforts to improve it. "We're trying to be proactive rather than reactive," said Bob VanderClute, vice president of safety at the AAR trade group. The nation's major freight railroads plan to invest roughly $13 billion in maintaining and upgrading their rail networks. That will pay for replacing railroad ties and track that are worn and adding new track to handle more freight. And since the mid-1990s, railroads have been increasingly using technology to identify problems early. For instance, all the major freight railroads have sensors installed along their lines that listen for the sound of flat spots developing on a car's wheels. The railroads can then replace the worn wheels before they have a chance to damage the rails or break. Other sensors along the tracks measure the temperature of wheel bearings as trains pass by to identify faulty ones. Union Pacific built an ultrasonic wheel-testing facility at its North Platte, Neb., railyard to help spot defective wheels. The robotic system scans every wheel in UP's coal fleet once every 60-to-90 days. The railroads have also improved safety training for workers and developed simulators for training that are based on video-game technology, so employees have a chance to practice before working with real trains. "Derailments are bad business all the way around," said Zarembski, who led a railroad consulting company for 27 years. But railroad crossing accidents, where a car's driver pulls in front of a train, are difficult to eliminate unless crossings are closed, Zarembski said, because it takes several miles to stop a moving train. The AAR trade group says most of the accidents at railroad crossings are caused by motorist error. For instance, government statistics show that 598 of last year's 1,960 crossing accidents were caused by motorists failing to stop. Another 444 accidents were caused by drivers stopping on tracks. Still, safety has improved in that area as well because of the efforts of groups such as Operation Lifesaver, a nonprofit organization that makes motorists more aware of the hazards of crossings. There has also been a decline in the number of crossings as more elevated tracks and overpasses are built.