Updated the script to be a single line for for-loop.