changes and refactoring code in child_stats