Guard against empty lists.

Also use clearer naming of departments.