private MoneyAccount parseRowToAccount(WebElement tr) throws AliorClientException {
		List<WebElement> tds = tr.findElements(By.tagName("td"));
		MoneyAccount account = null;
		for (int i = 0; i < tds.size(); i++) {
			WebElement td = tds.get(i);
			switch (i) {
				case 0:
					// on/off overnight
					break;

				case 1:
					// account number and role
					String[] num_role = td.getText().split("\n");
					if (num_role.length != 2) {
						throw new AliorClientException("Account number/role pair length is " + num_role.length + " instead of 2");
					}
					String number = num_role[0].trim().replaceAll("\\s", "");
					String role = num_role[1].trim().split(":")[1];

					account = new MoneyAccount(number);
					account.setRole(role);
					break;

				case 2:

					WebElement span = td.findElement(By.tagName("span"));

					String name = null;

					WebElement b = null;
					try {
						b = span.findElement(By.tagName("b"));
						name = b.getText();
					} catch (NoSuchElementException e) {
						name = "(no name)";
					}

					String type = span.getText().substring(name.length());

					account.setName(name.replaceAll("\\s", ""));
					account.setType(type.replaceAll("\\s", ""));
					break;

				case 3:
					String currency = td.getText().trim();
					account.setCurrency(currency);
					break;

				case 4:
					String bookBalance = td.getText().replaceAll("\\s", "").replaceAll(",", ".");
					double bbal = Double.parseDouble(bookBalance);
					account.setBookBalance(bbal);
					break;

				case 5:
					String availableBalance = td.getText().replaceAll("\\s", "").replaceAll(",", ".");
					double abal = Double.parseDouble(availableBalance);
					account.setAvailableBalance(abal);
					break;
			}
		}

		return account;
	}