reverse_metgen.sh updated and tidied up