Better Ruby exceptions

Like Python, uses KeyError for key not found and duplicate keys found.