Merge "Refactoring in preparation for NIO2 changes."