added 2D interpolation, simplified code everywhere