Further optimizations to analysis
Using Counter from collections