Some refactorings.
Handling duplicate fields.