Single file source generation pattern.
Removed duplication.