better usage of promises