clean up code, add missing Stats.js