removes global variable S