Updated Matrix, fixed bugs