added better promise support