Fixed bugs, script runs fine.