rewrite 'stats' code without zepto