Moved code to file
Use external files for I/O