Moved matrix to libsyntyche and fixed some bugs