Added some exception handling for IO errors, and some prints for better debugging