Cleaned up the script. Added randomizer for filenames so it won't fail some times using date.