Move Matroska section into separate file
Break up logic to make it easier to read