Remove unnecessary counters
Some code refactoring