factored out reshapeMatrix and computeStats, removed temp files. Cleaned up writeReal using writeMatrix, further cleaned writeChubukov with reshapeMatrix. partially cleaned validate files with computeStats