Few modifications to use of promises