modified script according to keep