refactor code: added '.then' to the promise objects