added grainproc stuff