Use enumerate and zip instead of xrange to loop over the surface.