Moved 15 lines out of options_form into separate function #2033