Refactor to two-step process. build then generate