Added matrix, changed other files to use it