Added key to duties.
Code formatting.
Added DutyFactory.