refactoring code io