Added sychronized calls

To prevent ConcurrentModificationExceptions.