refactored script to pull values from the configuration, removed unused functions to minimize size