refactored io package