moving examples and fixing setImmediate race condisition in tests