corrections, optimizations, some stats added