diff --git a/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
index 32550c9..e42f01e 100755
--- a/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.core/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@
 Export-Package: org.eclipse.fx.core;version="3.0.0",
  org.eclipse.fx.core.adapter;version="3.0.0",
  org.eclipse.fx.core.app;version="3.0.0",
+ org.eclipse.fx.core.array;version="3.0.0",
  org.eclipse.fx.core.bindings;version="3.0.0",
  org.eclipse.fx.core.command;version="3.0.0",
  org.eclipse.fx.core.event;version="3.0.0",
diff --git a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/ArrayUtils.java b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/array/ArrayUtils.java
similarity index 68%
rename from bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/ArrayUtils.java
rename to bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/array/ArrayUtils.java
index f2a5651..2ee76d0 100644
--- a/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/ArrayUtils.java
+++ b/bundles/runtime/org.eclipse.fx.core/src/org/eclipse/fx/core/array/ArrayUtils.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2016 BestSolution.at and others.
+ * Copyright (c) 2017 BestSolution.at and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -8,14 +8,23 @@
  * Contributors:
  *     Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
  *******************************************************************************/
-package org.eclipse.fx.core;
+package org.eclipse.fx.core.array;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.PrimitiveIterator;
+import java.util.PrimitiveIterator.OfInt;
+import java.util.Spliterator;
+import java.util.Spliterators;
+import java.util.function.IntConsumer;
 import java.util.function.IntFunction;
 import java.util.function.Supplier;
+import java.util.stream.IntStream;
+import java.util.stream.StreamSupport;
 
 /**
  * Utility methods to deal with arrays
@@ -108,4 +117,48 @@
 		}
 		return rv;
 	}
+
+	/**
+	 * Create a character stream similar to
+	 * {@link Arrays#stream(int[], int, int)}
+	 *
+	 * @param content
+	 *            the content
+	 * @param startInclusive
+	 *            the first index to cover, inclusive
+	 * @param endExclusive
+	 *            index immediately past the last index to cover
+	 * @return stream of characters
+	 */
+	public static IntStream stream(char[] content, int startInclusive, int endExclusive) {
+		OfInt ofInt = new PrimitiveIterator.OfInt() {
+			int cur = startInclusive;
+
+			@Override
+			public boolean hasNext() {
+				return this.cur < endExclusive;
+			}
+
+			@Override
+			public int nextInt() {
+				if (hasNext()) {
+					return content[this.cur];
+				} else {
+					throw new NoSuchElementException();
+				}
+			}
+
+			@Override
+			public void forEachRemaining(IntConsumer action) {
+				while (this.cur < endExclusive) {
+					action.accept(content[this.cur]);
+					this.cur++;
+				}
+			}
+
+		};
+		return StreamSupport.intStream(
+				() -> Spliterators.spliterator(ofInt, endExclusive - startInclusive, Spliterator.ORDERED),
+				Spliterator.SUBSIZED | Spliterator.SIZED | Spliterator.ORDERED, false);
+	}
 }
diff --git a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/TextGrid.java b/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/TextGrid.java
deleted file mode 100644
index c6732da..0000000
--- a/bundles/runtime/org.eclipse.fx.ui.controls/src/org/eclipse/fx/ui/controls/styledtext/TextGrid.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package org.eclipse.fx.ui.controls.styledtext;
-
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import org.eclipse.fx.ui.controls.styledtext.StyledTextContent.TextChangeListener;
-
-import javafx.application.Application;
-import javafx.beans.Observable;
-import javafx.beans.property.DoubleProperty;
-import javafx.beans.property.SimpleDoubleProperty;
-import javafx.geometry.Orientation;
-import javafx.scene.Scene;
-import javafx.scene.control.ScrollBar;
-import javafx.scene.layout.BorderPane;
-import javafx.scene.layout.StackPane;
-import javafx.scene.text.Font;
-import javafx.scene.text.Text;
-import javafx.stage.Stage;
-
-class TextGrid extends BorderPane {
-	private StyledTextContent content = new DefaultContent();
-
-	public TextGrid() {
-		ContentLayer grid = new ContentLayer(this);
-		setCenter(grid);
-
-		ScrollBar vScroll = new ScrollBar();
-		vScroll.maxProperty().bind(grid.virtualHeight);
-		vScroll.valueProperty().addListener(e -> {
-			grid.setVShift(vScroll.getValue());
-		});
-		vScroll.setOrientation(Orientation.VERTICAL);
-		setRight(vScroll);
-
-		ScrollBar hScroll = new ScrollBar();
-		hScroll.maxProperty().bind(grid.virtualWidth);
-		hScroll.valueProperty().addListener( e -> {
-			grid.setHShift(hScroll.getValue());
-		});
-		setBottom(hScroll);
-	}
-
-	public void setText(String text) {
-		content.setText(text);
-	}
-
-	private static class ContentLayer extends StackPane {
-		private Text[][] textGrid = new Text[0][0] ;
-		private Text calcNode;
-		private int columnOffset;
-		private int rowOffset;
-
-		private DoubleProperty virtualHeight = new SimpleDoubleProperty(100);
-		private DoubleProperty virtualWidth = new SimpleDoubleProperty(100);
-		private int longestLine;
-		private double totalHeight;
-		private final TextGrid container;
-
-		Font font = Font.font("Monospace", 13);
-
-		public ContentLayer(TextGrid container) {
-			this.container = container;
-			this.calcNode = new Text("m");
-			this.calcNode.setFont(font);
-			this.calcNode.setManaged(false);
-			getChildren().add(this.calcNode);
-			widthProperty().addListener(this::handleWidthChange);
-			heightProperty().addListener(this::handleHeightChange);
-			container.content.addTextChangeListener( new TextChangeListener() {
-
-				@Override
-				public void textChanged(TextChangedEvent event) {
-					update();
-				}
-
-				@Override
-				public void textSet(TextChangedEvent event) {
-					update();
-				}
-
-				@Override
-				public void textChanging(TextChangingEvent event) {
-					update();
-				}
-
-				private void update() {
-					totalHeight = 0;
-					longestLine = 0;
-					for( int i = 0; i < container.content.getLineCount(); i++ ) {
-						totalHeight += getTextHeight();
-						longestLine = Math.max(longestLine, container.content.getLine(i).length());
-					}
-
-					if(  textGrid.length > 0 ) {
-						virtualWidth.set(longestLine * getTextWidth() - textGrid[0].length * getTextWidth() );
-					}
-					virtualHeight.set(totalHeight - (textGrid.length - 2) * getTextHeight());
-				}
-			});
-		}
-
-		private Text[] allocate(int amount) {
-			Text[] rv = new Text[amount];
-			for( int i = 0; i < amount; i++ ) {
-				rv[i] = new Text();
-				rv[i].setFont(font);
-				rv[i].setManaged(false);
-			}
-			getChildren().addAll(rv);
-			return rv;
-		}
-
-		private void deallocate(Text... texts) {
-			getChildren().removeAll(texts);
-		}
-
-		private int getTextWidth() {
-			return (int) Math.ceil(this.calcNode.getLayoutBounds().getWidth());
-		}
-
-		private int getTextHeight() {
-			return (int) Math.ceil(this.calcNode.getLayoutBounds().getHeight());
-		}
-
-		private void handleWidthChange(Observable o, Number ol, Number ne) {
-			this.calcNode.autosize();
-			double s = getTextWidth();
-
-			int textCount = (int)Math.ceil(getWidth() / s) + 2;
-
-			if( this.textGrid.length == 0) {
-				this.textGrid = new Text[1][0];
-				this.textGrid[0] =  allocate(textCount);
-			} else {
-				int length = this.textGrid[0].length;
-				if(length < textCount ) {
-					int delta = textCount - length;
-					for( int i = 0; i < this.textGrid.length; i++ ) {
-						Text[] newLine = new Text[textCount];
-						System.arraycopy(this.textGrid[i], 0, newLine, 0, this.textGrid[i].length);
-						System.arraycopy(allocate(delta),0,newLine,length,delta);
-						this.textGrid[i] = newLine;
-					}
-				} else if( length > textCount ) {
-					int delta = length - textCount;
-					for( int i = 0; i < this.textGrid.length; i++ ) {
-						Text[] newLine = new Text[textCount];
-						System.arraycopy(this.textGrid[i], 0, newLine, 0, textCount);
-						Text[] cleanup = new Text[delta];
-						for( int j = 0; j < delta; j++ ) {
-							cleanup[j] = this.textGrid[i][textCount+j];
-						}
-						deallocate(cleanup);
-						this.textGrid[i] = newLine;
-					}
-				}
-			}
-
-			fixContent();
-
-			virtualWidth.set(longestLine * getTextWidth() - textGrid[0].length * getTextWidth() );
-		}
-
-		private void handleHeightChange(Observable o, Number ol, Number ne) {
-			this.calcNode.autosize();
-			double s = Math.ceil(this.calcNode.getLayoutBounds().getHeight());
-
-			int textCount = (int)Math.ceil(getHeight() / s) + 2;
-
-			if( this.textGrid.length == 0) {
-				this.textGrid = new Text[textCount][0];
-			} else if(this.textGrid.length < textCount ) {
-				int delta = textCount - this.textGrid.length;
-				Text[][] newGrid = new Text[textCount][this.textGrid[0].length];
-				for( int i = 0; i < this.textGrid.length; i++ ) {
-					System.arraycopy(this.textGrid[i], 0, newGrid[i], 0, this.textGrid[i].length);
-				}
-
-				for( int i = 0; i < delta; i++ ) {
-					newGrid[this.textGrid.length+i] = allocate(this.textGrid[0].length);
-				}
-				this.textGrid = newGrid;
-			} else if( this.textGrid.length > textCount ) {
-				int delta = this.textGrid.length - textCount;
-				Text[][] newGrid = new Text[textCount][this.textGrid[0].length];
-				for( int i = 0; i < textCount; i++ ) {
-					System.arraycopy(this.textGrid[i], 0, newGrid[i], 0, this.textGrid[0].length);
-				}
-				for( int i = 0; i < delta; i++ ) {
-					deallocate(this.textGrid[textCount+i]);
-				}
-				this.textGrid = newGrid;
-			}
-
-			fixContent();
-			virtualHeight.set(totalHeight - (textGrid.length - 2) * getTextHeight());
-		}
-
-		private void fixContent() {
-			for( int r = 0; r < this.textGrid.length; r++ ) {
-				int row = r + this.rowOffset;
-				for( int c = 0; c < this.textGrid[r].length; c++ ) {
-					if( row < container.content.getLineCount() ) {
-						String l = container.content.getLine(row);
-						int col = c + this.columnOffset;
-						if( col < l.length() ) {
-							this.textGrid[r][c].setText(String.valueOf(l.charAt(col)));
-						} else {
-							this.textGrid[r][c].setText(""); //$NON-NLS-1$
-						}
-					} else {
-						this.textGrid[r][c].setText(""); //$NON-NLS-1$
-					}
-				}
-			}
-		}
-
-		@Override
-		protected void layoutChildren() {
-			super.layoutChildren();
-			int y = 0;
-			for( int r = 0; r < this.textGrid.length; r++ ) {
-				int x = 0;
-				for( int c = 0; c < this.textGrid[r].length; c++ ) {
-					this.textGrid[r][c].relocate(x, y);
-					x += getTextWidth();
-				}
-				y += Math.ceil(this.calcNode.getLayoutBounds().getHeight());
-			}
-		}
-
-		public void setHShift(double value) {
-			int width = (int)getTextWidth();
-			double v = value % width;
-			setTranslateX(v*-1);
-			int columnOffset = (int)(value / width);
-			if( columnOffset != this.columnOffset ) {
-				this.columnOffset = columnOffset;
-				fixContent();
-			}
-		}
-
-		public void setVShift(double value) {
-			int height = (int) Math.ceil(this.calcNode.getLayoutBounds().getHeight());
-			double v = value % height;
-			setTranslateY(v*-1);
-			int rowOffset = (int)(value / height);
-			if( rowOffset != this.rowOffset ) {
-				this.rowOffset = rowOffset;
-				fixContent();
-			}
-		}
-	}
-
-
-	public static void main(String[] args) {
-		Application.launch(MyApplication.class, args);
-	}
-
-	public static class MyApplication extends Application {
-
-		@Override
-		public void start(Stage primaryStage) throws Exception {
-			TextGrid grid = new TextGrid();
-			grid.setText(new String( Files.readAllBytes(Paths.get("/Users/tomschindl/dart-samples/Grid.java")) ));
-			primaryStage.setScene(new Scene(grid, 500, 500));
-			primaryStage.show();
-		}
-
-	}
-}
\ No newline at end of file
