added output and input to and from file