Cut down matrix.js