Restructure to play nice asynchronously