Refactored out IO multiplexing