Refactored the gear setup code to separate the form code from the view code.