@Override
	public void insert(E x, int index) {
		if (index < 0) { // Check if the index is too small
			throw new ListIndexOutOfBoundsException("Index less than 0"); // If so, throw a ListIndexOutOfBoundsException with an appropriate message
		}
		// We don't need an else clause because the method will exit if the throw is executed

		if (index == 0) { // If the index is 0:
			this.addToFront(x); // We can call the addToFront() method to do the work for us
			return; // Leave the method
		}

		Node prevNode = this.head.next; // Instantiate the object that will be used as a reference to the node before the index to be inserted at to the head node
		for (int i = 1; i < index && prevNode != null; i ++, prevNode = prevNode.next); // Go through the list, checking if we are at the index before index and that we aren't at the end of the list

		if (prevNode != null) { // If we didn't leave the loop because we fell off the end:
			prevNode.next = new Node (x, prevNode, prevNode.next); // Create a new Node between prevNode and prevNode.next
			prevNode.next.next.previous = prevNode.next; // Set the previous node of the node after the new node to the new node
		}

		else {
			throw new ListIndexOutOfBoundsException("Index too large"); // If the index is too large, throw an exception
		}

	}