Refactored map / cache implementations.