added support for promises