Tidied up the analysis code so it runs with latest pdftables