refacto Input and Output