Removed window. from setImmediate calls