Change to one dimensional arrays to represent matrices, and clean up the transformation component