Use module pattern for statistics.js