Changes for use int instead of AtomicInteger