Remove useless callback.
Remove code duplication.
Add counting metric.
Huge refactoring to avoid using callback.