added counter and tests