Rewrote matrix.js to avoid using jQuery, completely removed jQuery dependency