move populating modules out of CTE