(#445) Use setImmediate and code style changes.