Refactor build_schema to be fully asynchronous.