counter reimplemented