refactoring + stats