Added best counting function ever.