Cleanup code
Compatibility for Python 3

dict_values objects don't support indexing (since they're views)