Code refactoring

New class handles input / output functions.