Added function to get matrix