Adding promise and rearrange controller