added feature for better saving/loading matrices