Rewrite of lots of scripts to use a new Perl module to unify code