stats js, still messy