Finished CD matrix fitting stuff