change toStr to take an object (vs HashMap)
change test at bottom to not convert to hash