def do_step(k,i):
    print i
    ds = timeseries[i]

    #Get the surface and scalars from the first one in the series
    surf_poly = ttf.read_step(linesurf[i])

    normals = ttf.get_data(surf_poly, 'perp')
    parallels = ttf.get_data(surf_poly, 'par')
    torsionals = ttf.get_data(surf_poly, 'phi')

    #Extract the wave flux mayavi field from the yt dataset
    fwfield = util.get_mlab_field_yt(ds, 'wave_flux_x', 'wave_flux_y', 'wave_flux_z', cube_slice=cube_slice)

    #Interpolate the Wave flux to the velocity surface
    surface_fwave_filter, surface_fwave = ttf.interpolate_vectors(fwfield.outputs[0],
                                                                 surf_poly)

    Fwperp, Fwpar, Fwphi = ttf.get_surface_velocity_comp(surface_fwave,
                                                         normals, torsionals,
                                                         parallels)

    ttf.write_wave_flux(path_join("WaveFlux_%s_%s_%s_%05i.vtp"%(cfg.driver, cfg.str_period, cfg.amp, i+1)),
                             surf_poly, parallels, normals, torsionals, Fwpar, Fwperp, Fwphi)

    Fpar_line[k] = Fwpar[save_index[i]]
    Fperp_line[k] = Fwperp[save_index[i]]
    Fphi_line[k] = Fwphi[save_index[i]]
    bpert = util.update_yt_to_mlab_vector(
        bpert, ds, "mag_field_x_pert", "mag_field_y_pert", "mag_field_z_pert", cube_slice
    )
    # Update surface
    ttf.update_flux_surface(surf_seeds[n], surf_field_lines, surface)
    # Get velocities at surface
    surface_velocities = ttf.update_interpolated_vectors(False, surface_vel_filter)
    # Get surface magfield
    surface_bfield = ttf.update_interpolated_vectors(False, surface_mag_filter)

    surface_bpert = ttf.update_interpolated_vectors(False, surface_bpert_filter)

    # Get vectors at surface
    normals, torsionals, parallels = ttf.get_surface_vectors(poly_norms, surface_bfield)
    # Get velocity componets at surface
    vperp, vpar, vphi = ttf.get_surface_velocity_comp(surface_velocities, normals, torsionals, parallels)

    # Get magnetic field pertubation componets at surface
    bpertperp, bpertpar, bpertphi = ttf.get_surface_velocity_comp(surface_bpert, normals, torsionals, parallels)

    surface_density = ttf.update_interpolated_scalars(surface.output, surface_den_filter)
    surface_va = ttf.update_interpolated_scalars(surface.output, surface_va_filter)
    surface_beta = ttf.update_interpolated_scalars(surface.output, surface_beta_filter)
    surface_cs = ttf.update_interpolated_scalars(surface.output, surface_cs_filter)

    # Save the file
    writer = ttf.PolyDataWriter(
        path_join("Fieldline_surface_{}_{:05d}.vtp".format(cfg.get_identifier(), n + 1)), surface.output
    )
    writer.add_array(
        perp=normals,