Moved invoke_when_ready to a detail namespace
Refactored invoke_when_ready callback to be its shared state