addMain moved to buildDepMap.