Restructuring to avoid a callback.