diff --git a/exec/votequorum.c b/exec/votequorum.c
index d7c99e5..51077a1 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -39,8 +39,6 @@
 #include <stdint.h>
 
 #include <qb/qbipc_common.h>
-#include <qb/qbdefs.h>
-#include <qb/qbutil.h>
 
 #include "quorum.h"
 #include <corosync/corodefs.h>
@@ -89,6 +87,7 @@ static uint32_t ev_barrier = 0;
 
 struct req_exec_quorum_nodeinfo {
 	struct qb_ipc_request_header header __attribute__((aligned(8)));
+	uint32_t nodeid;
 	uint32_t votes;
 	uint32_t expected_votes;
 	uint16_t flags;
@@ -137,8 +136,7 @@ static int votequorum_exec_send_reconfigure(uint8_t param, unsigned int nodeid,
 
 #define NODE_FLAGS_LEAVING 1
 
-#define NODEID_US 0
-#define NODEID_QDEVICE UINT32_MAX
+#define NODEID_QDEVICE 0
 
 typedef enum {
 	NODESTATE_MEMBER=1,
@@ -152,7 +150,6 @@ struct cluster_node {
 	uint32_t votes;
 	uint32_t expected_votes;
 	uint16_t flags;
-	unsigned long long int last_hello; /* Only used for quorum devices */
 	struct list_head list;
 };
 
@@ -163,6 +160,7 @@ struct cluster_node {
 static uint8_t quorum;
 static uint8_t cluster_is_quorate;
 static uint8_t first_trans = 1;
+static uint8_t quorum_device_registered = 0;
 
 /*
  * votequorum membership data
@@ -193,6 +191,7 @@ static struct list_head trackers_list;
  */
 
 static corosync_timer_handle_t quorum_device_timer;
+static int quorum_device_timer_set = 0;
 static corosync_timer_handle_t last_man_standing_timer;
 static int last_man_standing_timer_set = 0;
 
@@ -391,9 +390,7 @@ static struct cluster_node *allocate_node(unsigned int nodeid)
 	if (cl) {
 		memset(cl, 0, sizeof(struct cluster_node));
 		cl->node_id = nodeid;
-		if (nodeid) {
-			node_add_ordered(cl);
-		}
+		node_add_ordered(cl);
 	}
 
 	LEAVE();
@@ -408,16 +405,6 @@ static struct cluster_node *find_node_by_nodeid(unsigned int nodeid)
 
 	ENTER();
 
-	if (nodeid == NODEID_US) {
-		LEAVE();
-		return us;
-	}
-
-	if (nodeid == NODEID_QDEVICE) {
-		LEAVE();
-		return quorum_device;
-	}
-
 	list_iterate(tmp, &cluster_members_list) {
 		node = list_entry(tmp, struct cluster_node, list);
 		if (node->node_id == nodeid) {
@@ -442,6 +429,7 @@ static void get_lowest_node_id(void)
 	list_iterate(tmp, &cluster_members_list) {
 		node = list_entry(tmp, struct cluster_node, list);
 		if ((node->state == NODESTATE_MEMBER) &&
+		    (node->node_id != NODEID_QDEVICE) &&
 		    (node->node_id < lowest_node_id)) {
 			lowest_node_id = node->node_id;
 		}
@@ -526,10 +514,6 @@ static int calculate_quorum(int allow_decrease, unsigned int max_expected, unsig
 		}
 	}
 
-	if (quorum_device && quorum_device->state == NODESTATE_MEMBER) {
-		total_votes += quorum_device->votes;
-	}
-
 	if (max_expected > 0) {
 		highest_expected = max_expected;
 	}
@@ -644,7 +628,8 @@ static void recalculate_quorum(int allow_decrease, int by_current_nodes)
 
 	list_iterate(nodelist, &cluster_members_list) {
 		node = list_entry(nodelist, struct cluster_node, list);
-		if (node->state == NODESTATE_MEMBER) {
+		if ((node->state == NODESTATE_MEMBER) ||
+		    (node->node_id == NODEID_QDEVICE)) {
 			if (by_current_nodes) {
 				cluster_members++;
 			}
@@ -768,9 +753,6 @@ static char *votequorum_readconfig_static(void)
 
 static void votequorum_readconfig_dynamic(void)
 {
-	int cluster_members = 0;
-	struct list_head *tmp;
-
 	ENTER();
 
 	log_printf(LOGSYS_LEVEL_DEBUG, "Reading dynamic configuration");
@@ -788,19 +770,11 @@ static void votequorum_readconfig_dynamic(void)
 		quorumdev_poll = DEFAULT_QDEV_POLL;
 	}
 
-	icmap_get_uint8("quorum.two_node", &two_node);
-	update_two_node();
-	/*
-	 * two_node mode is invalid if there are more than 2 nodes in the cluster!
-	 */
-	list_iterate(tmp, &cluster_members_list) {
-		cluster_members++;
-        }
-
-	if (two_node && cluster_members > 2) {
-		log_printf(LOGSYS_LEVEL_WARNING, "quorum.two_node was set but there are more than 2 nodes in the cluster. It will be ignored.");
-		two_node = 0;
+	if (!quorum_device_registered) {
+		icmap_get_uint8("quorum.two_node", &two_node);
 		update_two_node();
+	} else {
+		log_printf(LOGSYS_LEVEL_DEBUG, "qdevice is registered, ignoring two_node settings");
 	}
 
 	LEAVE();
@@ -892,17 +866,24 @@ static int votequorum_exec_send_reconfigure(uint8_t param, unsigned int nodeid,
 	return ret;
 }
 
-static int votequorum_exec_send_nodeinfo(void)
+static int votequorum_exec_send_nodeinfo(uint32_t nodeid)
 {
 	struct req_exec_quorum_nodeinfo req_exec_quorum_nodeinfo;
 	struct iovec iov[1];
 	int ret;
+	struct cluster_node *node;
 
 	ENTER();
 
-	req_exec_quorum_nodeinfo.votes = us->votes;
-	req_exec_quorum_nodeinfo.expected_votes = us->expected_votes;
-	req_exec_quorum_nodeinfo.flags = us->flags;
+	node = find_node_by_nodeid(nodeid);
+	if (!node) {
+		return -1;
+	}
+
+	req_exec_quorum_nodeinfo.nodeid = node->node_id;
+	req_exec_quorum_nodeinfo.votes = node->votes;
+	req_exec_quorum_nodeinfo.expected_votes = node->expected_votes;
+	req_exec_quorum_nodeinfo.flags = node->flags;
 	req_exec_quorum_nodeinfo.quorate = cluster_is_quorate;
 	req_exec_quorum_nodeinfo.wait_for_all_status = wait_for_all_status;
 	req_exec_quorum_nodeinfo.first_trans = first_trans;
@@ -938,9 +919,6 @@ static int votequorum_exec_send_quorum_notification(void *conn, uint64_t context
 		node = list_entry(tmp, struct cluster_node, list);
 		cluster_members++;
         }
-	if (quorum_device) {
-		cluster_members++;
-	}
 
 	size = sizeof(struct res_lib_votequorum_notification) + sizeof(struct votequorum_node) * cluster_members;
 	buf = alloca(size);
@@ -958,10 +936,6 @@ static int votequorum_exec_send_quorum_notification(void *conn, uint64_t context
 		res_lib_votequorum_notification->node_list[i].nodeid = node->node_id;
 		res_lib_votequorum_notification->node_list[i++].state = node->state;
         }
-	if (quorum_device) {
-		res_lib_votequorum_notification->node_list[i].nodeid = 0;
-		res_lib_votequorum_notification->node_list[i++].state = quorum_device->state | 0x80;
-	}
 	res_lib_votequorum_notification->header.id = MESSAGE_RES_VOTEQUORUM_NOTIFICATION;
 	res_lib_votequorum_notification->header.size = size;
 	res_lib_votequorum_notification->header.error = CS_OK;
@@ -1017,6 +991,7 @@ static void exec_votequorum_nodeinfo_endian_convert (void *message)
 
 	ENTER();
 
+	nodeinfo->nodeid = swab32(nodeinfo->nodeid);
 	nodeinfo->votes = swab32(nodeinfo->votes);
 	nodeinfo->expected_votes = swab32(nodeinfo->expected_votes);
 	nodeinfo->flags = swab16(nodeinfo->flags);
@@ -1042,16 +1017,16 @@ static void message_handler_req_exec_votequorum_nodeinfo (
 
 	log_printf(LOGSYS_LEVEL_DEBUG, "got nodeinfo message from cluster node %u", nodeid);
 	log_printf(LOGSYS_LEVEL_DEBUG, "nodeinfo message[%u]: votes: %d, expected: %d wfa: %d quorate: %d flags: %d",
-					nodeid,
+					req_exec_quorum_nodeinfo->nodeid,
 					req_exec_quorum_nodeinfo->votes,
 					req_exec_quorum_nodeinfo->expected_votes,
 					req_exec_quorum_nodeinfo->wait_for_all_status,
 					req_exec_quorum_nodeinfo->quorate,
 					req_exec_quorum_nodeinfo->flags);
 
-	node = find_node_by_nodeid(nodeid);
+	node = find_node_by_nodeid(req_exec_quorum_nodeinfo->nodeid);
 	if (!node) {
-		node = allocate_node(nodeid);
+		node = allocate_node(req_exec_quorum_nodeinfo->nodeid);
 		new_node = 1;
 	}
 	if (!node) {
@@ -1081,7 +1056,9 @@ static void message_handler_req_exec_votequorum_nodeinfo (
 		allow_downgrade = 1;
 		by_node = 1;
 	} else {
-		node->state = NODESTATE_MEMBER;
+		if (req_exec_quorum_nodeinfo->nodeid != NODEID_QDEVICE) {
+			node->state = NODESTATE_MEMBER;
+		}
 	}
 
 	if ((!cluster_is_quorate) &&
@@ -1107,6 +1084,7 @@ static void message_handler_req_exec_votequorum_nodeinfo (
 	}
 
 	if (new_node ||
+	    !req_exec_quorum_nodeinfo->nodeid ||
 	    req_exec_quorum_nodeinfo->first_trans || 
 	    old_votes != node->votes ||
 	    old_expected != node->expected_votes ||
@@ -1186,7 +1164,7 @@ static int votequorum_exec_exit_fn (void)
 
 	if (leave_remove) {
 		us->flags |= NODE_FLAGS_LEAVING;
-		ret = votequorum_exec_send_nodeinfo();
+		ret = votequorum_exec_send_nodeinfo(us->node_id);
 	}
 
 	LEAVE();
@@ -1218,6 +1196,16 @@ static char *votequorum_exec_init_fn (struct corosync_api_v1 *api)
 	us->state = NODESTATE_MEMBER;
 	us->votes = 1;
 
+	quorum_device = allocate_node(NODEID_QDEVICE);
+	if (!quorum_device) {
+		LEAVE();
+		return ((char *)"Could not allocate node.");
+	}
+	quorum_device->state = NODESTATE_DEAD;
+	quorum_device->votes = 0;
+	memset(quorum_device_name, 0, VOTEQUORUM_MAX_QDEVICE_NAME_LEN);
+	quorum_device_registered = 0;
+
 	votequorum_readconfig_dynamic();
 	recalculate_quorum(0, 0);
 
@@ -1229,7 +1217,7 @@ static char *votequorum_exec_init_fn (struct corosync_api_v1 *api)
 	/*
 	 * Start us off with one node
 	 */
-	votequorum_exec_send_nodeinfo();
+	votequorum_exec_send_nodeinfo(us->node_id);
 
 	LEAVE();
 
@@ -1294,10 +1282,11 @@ static void votequorum_confchg_fn (
 	if (member_list_entries) {
 		memcpy(quorum_members, member_list, sizeof(unsigned int) * member_list_entries);
 		quorum_members_entries = member_list_entries;
-		if (quorum_device) {
-			quorum_members[quorum_members_entries++] = 0;
+		votequorum_exec_send_nodeinfo(us->node_id);
+		if ((us->node_id == lowest_node_id) &&
+		    (quorum_device_registered)) {
+			votequorum_exec_send_nodeinfo(NODEID_QDEVICE);
 		}
-		votequorum_exec_send_nodeinfo();
 	}
 
 	memcpy(&quorum_ringid, ring_id, sizeof(*ring_id));
@@ -1386,20 +1375,18 @@ static void quorum_device_timer_fn(void *arg)
 {
 	ENTER();
 
-	if (!quorum_device || quorum_device->state == NODESTATE_DEAD) {
+	if ((!quorum_device_registered) ||
+	    (quorum_device->state == NODESTATE_DEAD) ||
+	    (!quorum_device_timer_set)) {
 		LEAVE();
 		return;
 	}
 
-	if ((quorum_device->last_hello / QB_TIME_NS_IN_SEC) + quorumdev_poll/1000 <
-	    (qb_util_nano_current_get () / QB_TIME_NS_IN_SEC)) {
-		quorum_device->state = NODESTATE_DEAD;
-		log_printf(LOGSYS_LEVEL_INFO, "lost contact with quorum device");
-		recalculate_quorum(0, 0);
-	} else {
-		corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-						 quorum_device_timer_fn, &quorum_device_timer);
-	}
+	quorum_device->state = NODESTATE_DEAD;
+	log_printf(LOGSYS_LEVEL_INFO, "lost contact with quorum device %s", quorum_device_name);
+	recalculate_quorum(0, 0);
+
+	quorum_device_timer_set = 0;
 
 	LEAVE();
 }
@@ -1421,7 +1408,11 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void *
 
 	log_printf(LOGSYS_LEVEL_DEBUG, "got getinfo request on %p for node %u", conn, req_lib_votequorum_getinfo->nodeid);
 
-	node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid);
+	if (!req_lib_votequorum_getinfo->nodeid) {
+		node = us;
+	} else {
+		node = find_node_by_nodeid(req_lib_votequorum_getinfo->nodeid);
+	}
 	if (node) {
 		struct cluster_node *iternode;
 		struct list_head *nodelist;
@@ -1436,10 +1427,6 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void *
 			}
 		}
 
-		if (quorum_device && quorum_device->state == NODESTATE_MEMBER) {
-			total_votes += quorum_device->votes;
-		}
-
 		res_lib_votequorum_getinfo.votes = us->votes;
 		res_lib_votequorum_getinfo.expected_votes = us->expected_votes;
 		res_lib_votequorum_getinfo.highest_expected = highest_expected;
@@ -1467,6 +1454,9 @@ static void message_handler_req_lib_votequorum_getinfo (void *conn, const void *
 		if (leave_remove) {
 			res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_LEAVE_REMOVE;
 		}
+		if (quorum_device_registered) {
+			res_lib_votequorum_getinfo.flags |= VOTEQUORUM_INFO_QDEVICE;
+		}
 	} else {
 		error = CS_ERR_NOT_EXIST;
 	}
@@ -1552,10 +1542,6 @@ static void message_handler_req_lib_votequorum_setvotes (void *conn, const void
 		goto error_exit;
 	}
 
-	if (!nodeid) {
-		nodeid = corosync_api->totem_nodeid_get();
-	}
-
 	votequorum_exec_send_reconfigure(VOTEQUORUM_RECONFIG_PARAM_NODE_VOTES, nodeid,
 					 req_lib_votequorum_setvotes->votes);
 
@@ -1642,16 +1628,32 @@ static void message_handler_req_lib_votequorum_qdevice_register (void *conn,
 
 	ENTER();
 
-	if (quorum_device) {
-		error = CS_ERR_EXIST;
+	if (two_node) {
+		log_printf(LOGSYS_LEVEL_INFO, "Qdevice cannot be used in combination with two_node");
+		error = CS_ERR_INVALID_PARAM;
+		goto error_exit;
+	}
+
+	if (quorum_device_registered) {
+		if ((!strncmp(req_lib_votequorum_qdevice_register->name,
+			     quorum_device_name, VOTEQUORUM_MAX_QDEVICE_NAME_LEN)) &&
+		    (quorum_device->votes == req_lib_votequorum_qdevice_register->votes)) {
+			goto error_exit;
+		} else {
+			log_printf(LOGSYS_LEVEL_INFO,
+				   "A new qdevice with different name (new: %s old: %s) or different votes (new: %u old: %u) is trying to re-register!",
+				   req_lib_votequorum_qdevice_register->name, quorum_device_name,
+				   req_lib_votequorum_qdevice_register->votes, quorum_device->votes);
+			error = CS_ERR_EXIST;
+			goto error_exit;
+		}
 	} else {
-		quorum_device = allocate_node(0);
-		quorum_device->state = NODESTATE_DEAD;
-		quorum_device->votes = req_lib_votequorum_qdevice_register->votes;
 		strcpy(quorum_device_name, req_lib_votequorum_qdevice_register->name);
-		list_add(&quorum_device->list, &cluster_members_list);
+		quorum_device_registered = 1;
+		quorum_device->votes = req_lib_votequorum_qdevice_register->votes;
 	}
 
+error_exit:
 	res_lib_votequorum_status.header.size = sizeof(res_lib_votequorum_status);
 	res_lib_votequorum_status.header.id = MESSAGE_RES_VOTEQUORUM_STATUS;
 	res_lib_votequorum_status.header.error = error;
@@ -1668,12 +1670,14 @@ static void message_handler_req_lib_votequorum_qdevice_unregister (void *conn,
 
 	ENTER();
 
-	if (quorum_device) {
-		struct cluster_node *node = quorum_device;
-
-		quorum_device = NULL;
-		list_del(&node->list);
-		free(node);
+	if (quorum_device_registered) {
+		if (quorum_device_timer_set) {
+			corosync_api->timer_delete(quorum_device_timer);
+			quorum_device_timer_set = 0;
+		}
+		quorum_device->state = NODESTATE_DEAD;
+		memset(quorum_device_name, 0, VOTEQUORUM_MAX_QDEVICE_NAME_LEN);
+		quorum_device_registered = 0;
 		recalculate_quorum(0, 0);
 	} else {
 		error = CS_ERR_NOT_EXIST;
@@ -1696,27 +1700,30 @@ static void message_handler_req_lib_votequorum_qdevice_poll (void *conn,
 
 	ENTER();
 
-	if (quorum_device) {
-		if (req_lib_votequorum_qdevice_poll->state) {
-			quorum_device->last_hello = qb_util_nano_current_get ();
-			if (quorum_device->state == NODESTATE_DEAD) {
-				quorum_device->state = NODESTATE_MEMBER;
-				recalculate_quorum(0, 0);
+	if (!quorum_device_registered) {
+		error = CS_ERR_NOT_EXIST;
+		goto error_exit;
+	}
 
-				corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-								 quorum_device_timer_fn, &quorum_device_timer);
-			}
-		} else {
-			if (quorum_device->state == NODESTATE_MEMBER) {
-				quorum_device->state = NODESTATE_DEAD;
-				recalculate_quorum(0, 0);
-				corosync_api->timer_delete(quorum_device_timer);
-			}
+	if (quorum_device_timer_set) {
+		corosync_api->timer_delete(quorum_device_timer);
+		quorum_device_timer_set = 0;
+	}
+
+	if (req_lib_votequorum_qdevice_poll->state) {
+		if (quorum_device->state == NODESTATE_DEAD) {
+			quorum_device->state = NODESTATE_MEMBER;
+			votequorum_exec_send_nodeinfo(NODEID_QDEVICE);
 		}
+		corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
+					 quorum_device_timer_fn, &quorum_device_timer);
+		quorum_device_timer_set = 1;
 	} else {
-		error = CS_ERR_NOT_EXIST;
+		quorum_device->state = NODESTATE_DEAD;
+		recalculate_quorum(0, 0);
 	}
 
+error_exit:
 	/*
 	 * send status
 	 */
@@ -1736,7 +1743,7 @@ static void message_handler_req_lib_votequorum_qdevice_getinfo (void *conn,
 
 	ENTER();
 
-	if (quorum_device) {
+	if (quorum_device_registered) {
 		log_printf(LOGSYS_LEVEL_DEBUG, "got qdevice_getinfo state %d", quorum_device->state);
 		res_lib_votequorum_qdevice_getinfo.votes = quorum_device->votes;
 		if (quorum_device->state == NODESTATE_MEMBER) {
diff --git a/include/corosync/ipc_votequorum.h b/include/corosync/ipc_votequorum.h
index 49f9cfa..c292702 100644
--- a/include/corosync/ipc_votequorum.h
+++ b/include/corosync/ipc_votequorum.h
@@ -106,6 +106,7 @@ struct res_lib_votequorum_status {
 #define VOTEQUORUM_INFO_LAST_MAN_STANDING       8
 #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER       16
 #define VOTEQUORUM_INFO_LEAVE_REMOVE           32
+#define VOTEQUORUM_INFO_QDEVICE                64
 
 struct res_lib_votequorum_getinfo {
 	struct qb_ipc_response_header header __attribute__((aligned(8)));
diff --git a/include/corosync/votequorum.h b/include/corosync/votequorum.h
index a1889a8..94f8634 100644
--- a/include/corosync/votequorum.h
+++ b/include/corosync/votequorum.h
@@ -50,9 +50,7 @@ typedef uint64_t votequorum_handle_t;
 #define VOTEQUORUM_INFO_LAST_MAN_STANDING       8
 #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER       16
 #define VOTEQUORUM_INFO_LEAVE_REMOVE           32
-
-#define VOTEQUORUM_NODEID_US 0
-#define VOTEQUORUM_NODEID_QDEVICE -1
+#define VOTEQUORUM_INFO_QDEVICE                64
 
 #define NODESTATE_MEMBER     1
 #define NODESTATE_DEAD       2
diff --git a/man/votequorum_getinfo.3.in b/man/votequorum_getinfo.3.in
index d50af49..d2248f5 100644
--- a/man/votequorum_getinfo.3.in
+++ b/man/votequorum_getinfo.3.in
@@ -63,6 +63,7 @@ struct votequorum_info {
 #define VOTEQUORUM_INFO_LAST_MAN_STANDING       8
 #define VOTEQUORUM_INFO_AUTO_TIE_BREAKER       16
 #define VOTEQUORUM_INFO_LEAVE_REMOVE           32
+#define VOTEQUORUM_INFO_QDEVICE                64
 .fi
 .PP
 The members starting node_ hold information specific to the requested nodeid, the other are
diff --git a/test/testvotequorum1.c b/test/testvotequorum1.c
index 033012f..075ff5e 100644
--- a/test/testvotequorum1.c
+++ b/test/testvotequorum1.c
@@ -128,6 +128,7 @@ int main(int argc, char *argv[])
 		if (info.flags & VOTEQUORUM_INFO_LAST_MAN_STANDING) printf("LastManStanding ");
 		if (info.flags & VOTEQUORUM_INFO_AUTO_TIE_BREAKER) printf("AutoTieBreaker ");
 		if (info.flags & VOTEQUORUM_INFO_LEAVE_REMOVE) printf("LeaveRemove ");
+		if (info.flags & VOTEQUORUM_INFO_QDEVICE) printf("Qdevice ");
 
 		printf("\n");
 	}
@@ -158,6 +159,7 @@ int main(int argc, char *argv[])
 			if (info.flags & VOTEQUORUM_INFO_LAST_MAN_STANDING) printf("LastManStanding ");
 			if (info.flags & VOTEQUORUM_INFO_AUTO_TIE_BREAKER) printf("AutoTieBreaker ");
 			if (info.flags & VOTEQUORUM_INFO_LEAVE_REMOVE) printf("LeaveRemove ");
+			if (info.flags & VOTEQUORUM_INFO_QDEVICE) printf("Qdevice ");
 			printf("\n");
 		}
 	}
diff --git a/test/testvotequorum2.c b/test/testvotequorum2.c
index 986cf9e..55acf0a 100644
--- a/test/testvotequorum2.c
+++ b/test/testvotequorum2.c
@@ -62,7 +62,8 @@ static void print_info(int ok_to_fail)
 int main(int argc, char *argv[])
 {
 	int pollcount=0, polltime=1;
-	int err;
+	int err, ret = 0;
+	unsigned int votes = 1;
 
 	if ( (err=votequorum_initialize(&handle, NULL)) != CS_OK) {
 		fprintf(stderr, "votequorum_initialize FAILED: %d\n", err);
@@ -77,23 +78,35 @@ int main(int argc, char *argv[])
 	if (argc >= 3 && atoi(argv[2])) {
 		polltime = atoi(argv[2]);
 	}
+	if (argc >= 4 && atoi(argv[3])) {
+		votes = atoi(argv[3]);
+	}
 
 	if (argc >= 2) {
-		if ( (err=votequorum_qdevice_register(handle, "QDEVICE", 4)) != CS_OK)
+		if ( (err=votequorum_qdevice_register(handle, "QDEVICE", votes)) != CS_OK) {
 			fprintf(stderr, "qdevice_register FAILED: %d\n", err);
+			ret = -1;
+			goto out;
+		}
 
 		while (pollcount--) {
 			print_info(0);
-			if ((err=votequorum_qdevice_poll(handle, 1)) != CS_OK)
+			if ((err=votequorum_qdevice_poll(handle, 1)) != CS_OK) {
 				fprintf(stderr, "qdevice poll FAILED: %d\n", err);
+				ret = -1;
+				goto out;
+			}
 			print_info(0);
 			sleep(polltime);
 		}
-		if ((err= votequorum_qdevice_unregister(handle)) != CS_OK)
+		if ((err= votequorum_qdevice_unregister(handle)) != CS_OK) {
 			fprintf(stderr, "qdevice unregister FAILED: %d\n", err);
+			ret = -1;
+			goto out;
+		}
 	}
 	print_info(1);
-
+out:
 	votequorum_finalize(handle);
-	return 0;
+	return ret;
 }
diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
index 0a21a3c..a333d41 100644
--- a/tools/corosync-quorumtool.c
+++ b/tools/corosync-quorumtool.c
@@ -348,6 +348,7 @@ static int display_quorum_data(int is_quorate, int loop)
 		if (info.flags & VOTEQUORUM_INFO_LAST_MAN_STANDING) printf("LastManStanding ");
 		if (info.flags & VOTEQUORUM_INFO_AUTO_TIE_BREAKER) printf("AutoTieBreaker ");
 		if (info.flags & VOTEQUORUM_INFO_LEAVE_REMOVE) printf("LeaveRemove ");
+		if (info.flags & VOTEQUORUM_INFO_QDEVICE) printf("Qdevice ");
 		printf("\n");
 	} else {
 		fprintf(stderr, "votequorum_getinfo FAILED: %d\n", err);
@@ -535,7 +536,8 @@ int main (int argc, char *argv[]) {
 	int opt;
 	int votes = 0;
 	int ret = 0;
-	uint32_t nodeid = VOTEQUORUM_NODEID_US;
+	uint32_t nodeid = 0;
+	uint32_t nodeid_set = 0;
 	nodeid_format_t nodeid_format = NODEID_FORMAT_DECIMAL;
 	name_format_t address_format = ADDRESS_FORMAT_NAME;
 	command_t command_opt = CMD_UNKNOWN;
@@ -582,15 +584,18 @@ int main (int argc, char *argv[]) {
 			break;
 		case 'n':
 			nodeid = strtol(optarg, &endptr, 0);
-			if ((nodeid == 0 && endptr == optarg) || nodeid <= 0) {
+			if ((nodeid == 0 && endptr == optarg) || nodeid < 0) {
 				fprintf(stderr, "The nodeid was not valid, try a positive number\n");
+				exit(2);
 			}
+			nodeid_set = 1;
 			break;
 		case 'v':
 			if (using_votequorum() > 0) {
 				votes = strtol(optarg, &endptr, 0);
 				if ((votes == 0 && endptr == optarg) || votes < 0) {
 					fprintf(stderr, "New votes value was not valid, try a positive number or zero\n");
+					exit(2);
 				} else {
 					command_opt = CMD_SETVOTES;
 				}
@@ -619,6 +624,13 @@ int main (int argc, char *argv[]) {
 		ret = show_status(nodeid_format, address_format);
 		break;
 	case CMD_SETVOTES:
+		if (!nodeid_set) {
+			if (cmap_get_uint32(cmap_handle, "runtime.votequorum.this_node_id", &nodeid) != CS_OK) {
+				fprintf(stderr, "Unable to retrive this node nodeid\n");
+				fprintf(stderr, "You must specify the nodeid when setting votes\n");
+				exit(2);
+			}
+		}
 		ret = set_votes(nodeid, votes);
 		break;
 	case CMD_SETEXPECTED:
