added deep hashCode function for grid