Made counter work with all page refreshes and ajax updates