Modified script to run in the data directory.