Added missing argument.
Simplified code.
Added when().
Added composite functions.
Added adapter for foreign promises.
Added timeout-based promise.
Added tests for new functions, tests split into several files.