Cut down the number of map and some thread safety improvements!