Better way to increment counter