made the script generalizable across datasets