Switch to use promises where possible

Done.