adding changes for setImmediate