Updated: Simplified script internals to reduce number of script calls required to maintain. Maintained same functionality