Improved usage of promises