partially converting to x.flat instead of x.grid