private static int nthFibNumber(int input) throws IOException{
		int out =0;
		int iterations = 0; // a counter incase we reach EOF and havent found the nth term
		boolean check = false;
		File fibs = new File("Fibs.txt");
		FileReader FR =null;
		BufferedReader reader =null;
		if(fibs.exists()){
			reader = new BufferedReader(new FileReader(fibs));
		}
		//		if(fibs.exists()&&!fibs.isDirectory()){
		//			// file has been found, read from file either N times or start calculating more numbers
		//			for(int i=0;i<input;i++)	{
		//				int current = reader.read();
		//				if(current==-1){
		//					check = false;	
		//				}
		//				if(reader.read()=='\''){
		//					iterations ++;
		//				}
		//			}
		//		}
		//		
		//		else{
		//			//file doesn't exist start calculating fibs
		//		}
		if(fibs.exists()&&!fibs.isDirectory()){
			while((reader.readLine() != null) && (check = false)){
				iterations++;	// we have another int
				if(iterations==input){
					out = getIntAtline(reader,input);
					check = true;// we have found the nth number yay
				}
			}
			if(!check){
				int filelength = getNumberOfLinesReader(reader);
				int a = getIntAtline(reader,filelength-2);
				int b = getIntAtline(reader,filelength-1);
				BufferedWriter appender = new BufferedWriter(new FileWriter("Fibs.txt", true));
				while(iterations<input){
					iterations++;
					int newB = nextFib(a,b);
					String arb = ""+newB;
					appender.append(arb);
					a=b;
					b=newB;
				}
				out = getIntAtline(reader,input);
			}
			// start adding more fib numbers calculate number, put it into the file then repeat till necessary (nth number)
		}
		else{
			File f = new File("Fibs.txt"); 
			f.createNewFile();
			// no file at all, first iteration, start generating fib sequence and writing to file
			int a2=1;
			int b2=1;
			BufferedWriter appender = new BufferedWriter(new FileWriter("Fibs.txt", true));
			while(iterations<input){
				iterations++;
				int newB = nextFib(a2,b2);
				String arb = ""+newB;
				appender.append(arb);
				a2=b2;
				b2=newB;
			}
			out = getIntAtline(reader,input);
		}
		return out;
	}