minor main cleanup
to_json dedup and minor cleanup