public static Node find_predecessor(Node node, Key id) throws RemoteException, MalformedURLException
	{

		Node successor = null;
		Node startNode = node;

		Registry remote = LocateRegistry.getRegistry("rmi:/" + node.getLocalID().getIP() + ":1099/");
		System.out.println(node.getLocalID().getIP());
		try
		{
			IdKey succID = node.getImmediateSuccessor();
			try
			{
				// sets at the local variable successor, successor's node(from the rmiRegistry)
				successor = (Node) Naming.lookup("/" + succID.getIP() + ":1099/" +String.valueOf(succID.getPID()));
			}
			catch (MalformedURLException ex)
			{
				Log.addMessage("MalformedURLException", Log.ERROR);
			}
		}
		catch (RemoteException ex)
		{
			Log.addMessage("find_predecessor-RExc[0]:A problem occurred while attempting to find  the appropriate predecessor. It will be corrected in the next repetition of the stabilize.", Log.ERROR);
			throw new NullPointerException();
			//return null;
		}
		catch (NotBoundException ex)
		{
			Log.addMessage("find_predecessor-NBexc[0]:A problem occurred when finding the appropriate predecessor for: " + id.toString() + "\n" + "The successor of " + node.getLocalID().toString() + " is not bound or was unbound. "
			               + "Try connecting later", Log.ERROR);
			throw new NullPointerException();
		}

		//holds the value of node at every repeatition
		Node checkNode = null;

		//holds the number of hops in the repeatition
		int hops = 0;

		try
		{
			// loop continues, until id is betwenn (tempNode, tempNode.successor)
			while (!Key.isBetweenSuccessor(id, node.getLocalID(), node.getImmediateSuccessor()))
			{
				if (!(checkNode == null))
				{
					if (checkNode.getLocalID().equals(node.getLocalID()))
					{
						break;
					}
				}
				hops++;
				checkNode = node;
				//refresh node variable

				node = (Node) closest_preceding_finger(node, id);
				//refresh successor variable

				try
				{
					IdKey key = node.getImmediateSuccessor();

					successor = (Node) Naming.lookup("/" + key.getIP() + ":1099/" + String.valueOf(node.getImmediateSuccessor().getPID()));
				}
				catch (RemoteException ex)
				{
					Log.addMessage("find_predecessor-RExc[1]: A problem occurred while attempting to find  the appropriate successor of predecessor. It will be corrected in the next repetition of the stabilize.", Log.ERROR);

				}
				catch (NotBoundException ex)
				{
					Log.addMessage("find_predecessor-NBExc[1]: A problem occurred when finding the appropriate predecessor for: " + id.toString() +
					               "\n" + "The successor of " + node.getLocalID().toString() + " is not bound or was unbound. "
					               + "Try connecting later", Log.ERROR);
				}
			}
		}
		catch (RemoteException rexc)
		{
			Log.addMessage("find_predecessor-RExc[2]: A problem occurred while attempting to find  the appropriate successor of predecessor. It will be corrected in the next repetition of the stabilize.", Log.ERROR);
			//return null;
			throw new NullPointerException();
		}
		startNode.addHops(hops);
		return node;
	}