Renamed fields. Refactored into functional style.