applying modification for ticket #490 to use Train object.