Refactored the asynchronous initialization code