add new matrix converter and refactor code