more breaking refactoring to make async api work