added scans from book and cleaned up IO portion of code
fixing and tidying