Modified script for ToMaR input preparation