Made every collection synchronized

Need to synchronize the loops correctly.