Added matrix template