refactored counter to key