248 add statistics

Fixes all the comments of @garberg on #532, so it's ready to merge!