Better handling of promises and more accurate docs