preprocessing for Grimmer