Preventing ConcurrentModificationException
Fixing the NullPointerException