Changed counter from int to long