Refactor stats computation
Refactor put to reduce complexity