Modernise statistics script to work with rails 4.1
More modernisations for the statistics script