Refactor API & support Promises