Neat way of using toString by making the object hashable