change add_neighbors() to list_neighbors(); change i,j to x,y; change xrange stops to +2 instead of +1 (exclusive...duh)