Closes #1455. Finer grained sync
Fixed a real deadlock
Replaced many HashMap with ConcurrentHashMap