More refactoring + filter statistics output