Rewrite to python for most scripts, starting with on-the-fly conversion