public static void redistribute_keys(Node node) throws RemoteException
	{
		NodeImpl thisNode = (NodeImpl) node;
		IdKey predecessor = thisNode.getPredecessor();
		IdKey successor = thisNode.getImmediateSuccessor();

		byte[] step = toByteArray(1);

		Node predecessorNode = null, successorNode = null;

		try //set predecessorNode
		{
			try
			{
				predecessorNode = (Node) Naming.lookup("/" + predecessor.getIP() + ":1099/" + String.valueOf(predecessor.getPID()));
			}
			catch (MalformedURLException ex)
			{
				Log.addMessage("Malformed URL in redistribute_keys, while looking up for predecessor", Log.ERROR);
			}
		}
		catch (ConnectException ce)
		{
			System.out.println("Connect Exception in redistribute_keys, while looking up for predecessor");
			Log.addMessage("Could not connect to predecessor in redistribute_keys", Log.ERROR);
		}
		catch (NotBoundException ex)
		{
			System.out.println("A problem occurred in redistribute_keys. Predecessor is not bound or was unbound");
			Log.addMessage("A problem occurred in redistribute_keys. Predecessor is not bound or was unbound", Log.ERROR);
		}
		catch (AccessException ex)
		{
			System.out.println("Access Exception in redistribute_keys, while looking up for predecessor");
			Log.addMessage("Could not access the predecessor in redistribute_keys.", Log.ERROR);
		}

		try //set successorNode
		{
			try
			{
				successorNode = (Node) Naming.lookup("/" + successor.getIP() + ":1099/" +String.valueOf(successor.getPID()));
			}
			catch (MalformedURLException ex)
			{
				Log.addMessage("Malformed URL in redistribute_keys, while looking up for successor", Log.ERROR);
			}
		}
		catch (ConnectException ce)
		{
			System.out.println("Connect Exception in redistribute_keys, while looking up for successor");
			Log.addMessage("Could not connect to successor in redistribute_keys", Log.ERROR);
		}
		catch (NotBoundException ex)
		{
			System.out.println("A problem occurred in redistribute_keys. Successor is not bound or was unbound");
			Log.addMessage("A problem occurred in redistribute_keys. Successor is not bound or was unbound", Log.ERROR);
		}
		catch (AccessException ex)
		{
			System.out.println("Access Exception in redistribute_keys, while looking up for successor");
			Log.addMessage("Could not access the successor in redistribute_keys.", Log.ERROR);
		}

		/*
		 * for every IdKey in the successor, pass them to successor
		 */
		Map<IdKey, Set<FileEntry>> entries = node.getAllEntries();

		for (IdKey counter : entries.keySet())
		{
			successorNode.addEntries(counter, entries.get(counter));
		}

		successorNode.setPredecessor(predecessor);//successor's predecessor = node's predecessor
		predecessorNode.addSuccessor(successor, 0); // add successor to the sucList
		predecessorNode.removeSuccessor(1);//remove Node from the sucList

	}