public void open ()
  {
    //Check for saving the current file
    if (checkSaved ()){
      final Lawgbook l = display.getLawgbook ();
      File file;
      //This crashed a few times with a nullpointerException
      fileChooser.showOpenDialog(this); //I need to access a component for this to work. May have to move location of IO Methods
      file = fileChooser.getSelectedFile();
      if (file != null){
        //Create temporary arrayLists in case something goes wrong
        final ArrayList<Activity> a = new ArrayList<Activity>();
        a.addAll (l.getActivities());
        final ArrayList<Student> st = new ArrayList<Student>();
        st.addAll (l.getStudents());
        final ArrayList<Lesson> lessons = new ArrayList<Lesson>();
        lessons.addAll (l.getLessons());
        final String oldTitle = l.getTitle();
        final int [] stats = new int []{l.getTotalWeeks(),l.getWeeksPassed(),l.getActivityMin(),l.getLessonTime()};
        class Restore {
          public  void restoreData (){
            l.clearData();
            l.getActivities().addAll(a);
            l.getStudents().addAll (st);
            l.getLessons().addAll (lessons);
            l.setTitle (oldTitle);
            l.setTotalWeeks (stats [0]);
            l.setWeeksPassed (stats[1]);
            l.setActivityMin (stats [2]);
            l.setLessonTime (stats [3]);
          }
        }
        try{
          BufferedReader in = new BufferedReader (new FileReader (file));        
          l.clearData();
          //read in all the info
          in.readLine ();//The header
          l.setTitle (in.readLine ());
          l.setTotalWeeks (Integer.parseInt (in.readLine ()));
          l.setWeeksPassed (Integer.parseInt (in.readLine ()));
          l.setActivityMin (Integer.parseInt (in.readLine ()));
          l.setLessonTime (Integer.parseInt (in.readLine()));
          int numActivities = Integer.parseInt (in.readLine());
          for (int x = 0;x < numActivities;x++){
            String name = in.readLine ();
            int completed = Integer.parseInt (in.readLine ());
            int time = Integer.parseInt (in.readLine());
            int numItems = Integer.parseInt (in.readLine ());
            ArrayList<String> items = new ArrayList<String>();
            for (int y = 0;y < numItems;y++){
              items.add (in.readLine());
            }
            Activity ac = new Activity (name,completed);
            ac.setTime (time);
            ac.setItems (items);
            l.addActivity (ac);
          }
          int numStudents = Integer.parseInt (in.readLine ());
          for (int x = 0;x < numStudents;x++){
            String name = in.readLine ();
            l.addStudent (name);
            Student s = l.getStudent (x);
            for (int y = 0;y < numActivities;y++){
              String aName = in.readLine ();
              int rank = Integer.parseInt (in.readLine ());
              s.setRanking (aName,rank);
            }
          }
          int numLessons = Integer.parseInt (in.readLine ());
          for (int x = 0;x < numLessons;x++){
            String title = in.readLine();
            long time = Long.parseLong(in.readLine ());
            Date newDate = new Date (time);
            int listLength = Integer.parseInt (in.readLine ());
            ArrayList<Activity> list = new ArrayList<Activity>();
            for (int y = 0;y < listLength;y++){
              list.add (l.getActivity (in.readLine()));
            }
            String comments = in.readLine ();
            l.addLesson (new Lesson (title,newDate,list,comments));
          }
          in.readLine ();//footer
          in.close(); 
          //Do all checks to make sure the data is all good
          //necessary status changes
          l.setSaved (true);
          l.setFile (file);
          //Display the info
          show ("display");
        }        
        catch (IOException e)
        {
          JOptionPane.showMessageDialog (this,"File could not be found.","File IO error",JOptionPane.ERROR_MESSAGE);
        }
        //could clear this up with a nested method
//        catch (NumberFormatException n)
//        {
//          (new Restore()).restoreData ();
//          JOptionPane.showMessageDialog (this,"Corrupted Data.","File IO error",JOptionPane.ERROR_MESSAGE);
//        }
//        catch (NullPointerException p)
//        {
//          (new Restore()).restoreData ();
//          JOptionPane.showMessageDialog (this,"Corrupted Data.","File IO error",JOptionPane.ERROR_MESSAGE);
//        }
      }
    }
  }