Update script with latest changes from master.