Rather than syncronizing this, I think we should use AtomicInteger.