Added CommonJS implementation for promises