Changed to use promise chain in few cases.