add to_h function
Merge branch 'to_h'