added promise handling