Changes to the way roles are calculated

prevents 0%'s, also incorporates preference matches from v23, but
excludes v23 dfinstance.cpp changes to preferences.