public boolean remove(int key) {
		int index;
		Element element = elements.get(key);

		if (element == null) {
			return false;
		}

		if (elements.remove(key) == null) {
			return false;
		}

		for (Integer destination : element.getConnections()) {
			elements.get(destination).removeConnection(key);
		}

		CompoundEdit removeEdit = new CompoundEdit();

		for (int i = 0; i < bookmarks.size(); i++) {
			if (bookmarks.get(i).getKey() == element.getId()) {
				Bookmark removedBookmark = bookmarks.remove(i);

				removeEdit.addEdit(new RemoveBookmarkEdit(i, removedBookmark));
				firePropertyChange(BOOKMARK_REMOVED, removedBookmark, null);
				i--;
			}
		}

		if (element.isInSet1()) {
			index = keys1.indexOf(key);
			keys1.remove(index);
			firePropertyChange(ELEMENT_REMOVED_FROM_SET1, key, null);
		} else {
			index = keys2.indexOf(key);
			keys2.remove(index);
			firePropertyChange(ELEMENT_REMOVED_FROM_SET2, key, null);
		}

		UndoableEdit edit = new RemoveEdit(element, index);
		removeEdit.addEdit(edit);
		removeEdit.end();
		postEdit(removeEdit);

		return true;
	}