and call that after the UI is reconfigured, instead of having that code spread across the entire file.