using setTimeout instead of setImmediate for browser compatability in micro