added another huge chunk of the script