modified gethm2 to write pairs
edits to gethm2