public byte[] handleRequest(byte[] request) {
		try {
			String req = Utils.byteToString(request);
			if (req.startsWith(HEARTBEAT_COMMAND)) {
				req = req
						.substring((HEARTBEAT_COMMAND + COMMAND_PARAM_SEPARATOR)
								.length());
				logger.info(myInfo
						+ " recieved heartbeat ping with server list " + req);
				List<Machine> machinesToAdd = Machine.parseList(req);
				Set<Machine> currentMachines = getMachineList();
				for (Machine machine : machinesToAdd) {
					if (!currentMachines.contains(machine)) {
						this.addMachine(machine);
						logger.info(this.myInfo + " added " + machine
								+ " to known server list");
					} else {
						currentMachines.remove(machine);
					}
				}
				for (Machine machine : currentMachines) {
					this.removeMachine(machine.getId());
					logger.info(this.myInfo + " removed " + machine
							+ " from known server list");
				}
				return Utils.stringToByte(COMMAND_SUCCESS);
			} else if (req.startsWith(START_ELECTION_COMMAND)) {
				// TODO: handle election. SHould block all writes;
				return null;
			} else if (req.startsWith(END_ELECTION_COMMAND)) {
				// TODO: handle election ends. start new coordinator and start
				// acceptign reqs after coordinator
				return null;
			}
			return handleSpecificRequest(req);
		} catch (Exception e) {
			logger.error("Exception handling request in replica server", e);
			return Utils.stringToByte(COMMAND_FAILED + COMMAND_PARAM_SEPARATOR
					+ e.getMessage());
		}
	}