Converting more code to using promises