Fixed the script to run in a loop and added gitignore