solves #17
solves #16
Support promises #19