rewrite matrix for more speed.  better formatting.
speed up to 1s for 720p