Final version of script..

Cleaned up some loose code. Fixed a minor error. Good to go