finished fixing to 2D grid up until the data fitting (chi squared part)