corrected bug in pop() for counter, added clearStack() method