Corrected generation of variable field declarations. Some cosmetic refactoring