Code Refactor

Refactored Script file to make use of arrays and objects to optimize
code.  Restored functionality.