Use getOrElseUpdate to simplify implementation for mutable maps
Merge pull request #283