adding basic counter logic and url encoding