More refactoring to remove promises