Cleaning up nested conditionals in legacy controllers