Added some counter related code