RGEP.hs modified