Calculating structure functions on the lattice