smarter use of TryGetValue