more progress fleshing out code operation in mtex file
more improvements in diagnostics