replaced  'if (somethis) { set final field } else { final_field = null }' pattern with 'switch'. May be simpler to look at the actual file.