Added functions for input and output from/to file