Changed thread sleep time to 0
Added locking to methods of SearchIndex and SecondaryIndex to prevent ConcurrentModificationException