Update main.js

Encapsulation of gearChanged.