Small optimizations.

Started to add counter but having problems with it.