rewritten module generation