Added counter to stack class.