Update of GEM validation code

Mostly clean-up of the code