move byte counter to after validation
use a struct and allocator for stats