changed counter to atomic long for accurate counts