Minor bug in previous commit
JSON handling, better statistics