Added distance calculation to determine distance between two cells