Added matrix generating functions