cpp: refactored IOHandle to cpp file