A method of fabricating an accurately tuned grating structure in a waveguide comprises the steps of providing a waveguide having an etched Bragg grating formed in a photosensitive layer, guiding light into the waveguide, monitoring the Bragg wavelength, and exposing the photosensitive layer to tuning light so as to alter the refractive index of the photosensitive layer and thereby alter the Bragg wavelength of the waveguide. The grating is initially formed by e-beam lithography and dry etching, to provide a grating with relatively accurate periodicity. The Bragg wavelength of the grating is then fine tuned by exposing the photosensitive layer to UV light to adjust the effective refractive index whilst monitoring the optical spectrum of light reflected by the grating.