Modifications to help enable the NSStream handler